使用此函数我得到经度= 0和纬度= 0 我不知道问题出在哪里
<div ng-repeat="pages in topbarCtrl.topbar">
答案 0 :(得分:1)
在Google API客户端提供的onConnected()
回调中执行此操作,该回调在客户端准备就绪时调用。以下代码段说明了请求和响应的简单处理:
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()));
}
}
}