user1857437
user1857437

Reputation: 279

When should I disconnect GoogleApiClient (Android)

In my android app, I have 3 login options. Google+, Facebook, and my own login option. I've implemented all 3.

I've implemented Google+ login using the steps outlined here. Server side access is enabled.

I get the one time authorization code and pass it to my own api. Once I've received the authorization code, is there any reason to keep GoogleApiClient connected?

I have a similar question for Facebook Session here.

Upvotes: 3

Views: 2464

Answers (1)

Brian Attwell
Brian Attwell

Reputation: 9299

There is no reason to keep connected to the GoogleApiClient unless you plan on directly calling one of its APIs later. Once you have the authorization code, you can close the GoogleApiClient if you want.

What does doing this early get you? It clears a binder connection a bit earlier and allows the com.google.android.gms process to be removed from memory (it probably won't be removed from memory anyway for a while anyway on mid-to-high end phones) a bit sooner.

I wouldn't worry about this. As long as you close the GoogleApiClient before the end of Activity#onStop everything should be fine.

Upvotes: 3

Related Questions