“GoogleApiClient is not connected yet” exception in Cast application

Google APIs for Android > GoogleApiClient

You should instantiate a client object in your Activity’s onCreate(Bundle) method and then call connect() in onStart() and disconnect() in onStop(), regardless of the state.

The implementation of the GoogleApiClient appears designed for only a single instance. It’s best to instantiate it only once in onCreate, then perform connections and disconnections using the single instance.

I would guess that only one GoogleApiClient can be actually be connected, but multiple instances are receiving the onConnected callback.

In your case it’s probably fine to not call connect in onStart, but only in onRouteAdded.

I think this issue is very similar to Fatal Exception: java.lang.IllegalStateException GoogleApiClient is not connected yet

Leave a Comment