I want to create a library for GooglePlus. For this I created multiple classes like login, posting, fetching user profile.
Do I have to implement onConnected, onDisconnected, onConnectionFailed ? Do I have to call plusClient.connect() in every class?
Currently If I connect() in first(login) class and then tries to post on use's account from different activity then it's giving a problem. I have to connect() it again even if i have done this in previous activity.
Is there a solution for this that I can use same plusClient object in multiple activities?
Thanks in advance.
The PlusClient
class is designed to be lightweight so that there is no need to share a PlusClient
instances across activity instances. See:
Access google plus client from multiple activities
That said, there is nothing which prevents you from doing this as long as you make sure that PlusClient.connect()
and PlusClient.disconnect()
are called at appropriate times if you manage your PlusClient
as part of a service or application object.
Also, note that PlusClient
has now been deprecated in favour of GoogleApiClient
. For this discussion though, they are equivalent.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments