Java Question When to create instance of Google Play services

barx

Well-Known Member
Licensed User
Longtime User
The Data layer library for wearables requires Google Play services (well GoogleApi) client for connecting to the wearable. Just wondering if it would be seen as best practice to create 1 instance as object is initialized in b4a and close it when app closes. Or if it would be better to Create it on each a call to the data layer. I think, anot have currently been working towards the first idea. But did not if it was OK leaving the client connected whole time app is running. Thanks
 
Last edited:

barx

Well-Known Member
Licensed User
Longtime User
Google docs say:

Create object in Activity_create

Connect in Activity_Start (We don't have this so will probably just do it in the Initialize)

Do work in main code

Disconnect in Activity_Destroy

I was struggling to follow all the Google docs as usual so looked for more tutorials and dropped on this one.

http://toastdroid.com/tag/wear/

As you can see, this guy creates it in each sub. This being the only working example I read I wondered if this was 'the' way to do it. Probably the usual case of reading too much can be dangerous.
 
Top