In the Google+ Android PlusClient documentation it states that you should be executing .connect() and .disconnect() in onStart() and onStop().
I have several activities (about 8) which stack on top of eachother in various ways, and about 4 of those activities will require the PlusClient.
My base activity (which all those activities use).. I'm thinking of putting the PlusClient logic in there.
Without knowing the inner workings of the PlusClient itself I'm not sure how heavyweight it is to run connect()/disconnect() all the time in loads of activities. This was not clear in the documentation referenced above. The connect() / disconnect() methods are doing network requests in a background thread. It seems wasteful to me for the user to be clicking through all the activities and it doing multiple network requests doing the same thing.
I guess I am comparing this to the Facebook Android API which to me seems to have a "Session" type pattern which presents itself as being more efficient.
- Is this really the best pattern to adopt for an app which browses through multiple Activities a lot?
- Can these methods cope with not having a connection elegantly?