【发布时间】:2014-03-11 12:09:03
【问题描述】:
我初始化 LocationClient 和 LocationRequest
locationClient = new LocationClient(context, this, this);
request = LocationRequest.create();
request.setInterval(MIN_TIME);
request.setInterval(UPDATE_INTERVAL_IN_MILLISECONDS);
request.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
request.setFastestInterval(FAST_INTERVAL_CEILING_IN_MILLISECONDS);
连接到 GooglePlayServices
locationClient.connect();
并在执行回调方法时请求位置更新
@Override
public void onConnected(final Bundle bundle)
{
locationClient.requestLocationUpdates(request, this);//this exception point
}
但是抛出异常
java.lang.IllegalStateException: Not connected. Call connect() and wait for onConnected() to be called.
at com.google.android.gms.internal.k.B(Unknown Source)
at com.google.android.gms.internal.bh.a(Unknown Source)
at com.google.android.gms.internal.bh$c.B(Unknown Source)
at com.google.android.gms.internal.bg.requestLocationUpdates(Unknown Source)
at com.google.android.gms.internal.bh.requestLocationUpdates(Unknown Source)
at com.google.android.gms.internal.bh.requestLocationUpdates(Unknown Source)
at com.google.android.gms.location.LocationClient.requestLocationUpdates(Unknown Source)
at ru.etransport.locationlib.LocationListenerGPs.onConnected(LocationListenerGPs.java:45)
更新:我在连接之前使用 isGooglePlayServicesAvailable
【问题讨论】:
-
您好,您解决了吗?我目前面临同样的问题;)
标签: android google-play-services locationlistener