0
從IntentService中,我如何進行異步調用並避免在回調到達之前關閉服務?來自IntentService的異步調用
目前既不onConnected也不onConnectionFailed被稱爲:
private void initLocationUpdates() {
Log.d(TAG, "initLocationUpdates");
locationClient = new LocationClient(this, new ConnectionCallbacks() {
@Override
public void onDisconnected() {
Log.d(TAG, "onDisconnected");
}
@Override
public void onConnected(Bundle arg0) {
Log.d(TAG, "onConnected");
LocationRequest request = new LocationRequest();
request.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
request.setInterval(5);
locationClient.requestLocationUpdates(request, locationChangedPendingIntent);
}
}, new OnConnectionFailedListener() {
@Override
public void onConnectionFailed(ConnectionResult arg0) {
Log.d(TAG, "onConnectionFailed");
}
});
}