码迷,mamicode.com
首页 > 移动开发 > 详细

Android Location API

时间:2015-03-16 00:51:28      阅读:231      评论:0      收藏:0      [点我收藏+]

标签:

LocationClient现在无法使用,以下是新的解决方案
https://developer.android.com/training/location/retrieve-current.html

public class MainActivity extends ActionBarActivity implements
        ConnectionCallbacks, OnConnectionFailedListener {
    ...
    @Override
    public void onConnected(Bundle connectionHint) {
        mLastLocation = LocationServices.FusedLocationApi.getLastLocation(
                mGoogleApiClient);
        if (mLastLocation != null) {
            mLatitudeText.setText(String.valueOf(mLastLocation.getLatitude()));
            mLongitudeText.setText(String.valueOf(mLastLocation.getLongitude()));
        }
    }
}

 

Android Location API

标签:

原文地址:http://www.cnblogs.com/visionary/p/4340890.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!