I am using GoogleApiClient in a service to request fused location updates. Every thing is working correctly, but sometimes the connection is suspended and onConnectionSuspended is called.
@Override
public void onCreate() {
...
mGoogleApiClient = new GoogleApiClient.Builder(this) // this is a Context
.addApi(LocationServices.API)
.addConnectionCallbacks(this) // this is a [GoogleApiClient.ConnectionCallbacks][1]
.addOnConnectionFailedListener(this) //
.build();
mGoogleApiClient.connect();
...
}
@Override
public void onConnectionSuspended(int arg0) {
// what should i do here ? should i call mGoogleApiClient.connect() again ? ?
}
In the link above (ConnectionCallback doc) it says :
Applications should disable UI components that require the service, and wait for a call to onConnected(Bundle) to re-enable them.
But how this call to onConnected will happen ? should i call mGoogleApiClient.connect() again ? or the mGoogleApiClient will continue trying to connect even after a connection suspension ?