I'm trying to implement "cross device sign-on" using Google Plus in my Android app.
How to implement this is not very well documented, and the best documentation I have found is this video, and these sample apps in github.
Given the code of the sample Android app, and what the Google developers say in the video, I understand that the following would happen:
I install and start the app in device A. This device has only one Google account, which never logged in to the app.
onCreate() will call PlusClient#connect(). As the user never signed-in in the another device, we will get a onConnectionFailed().
If the user clicks in the sign-in button, the we will execute mLastConnectionResult.startResolutionForResult(), which will execute a PendingIntent that will ask for permission to the user.
Now that we the user has granted permissions, a new call to PlusClient#connect() will result in onConnected().
Now, in we install the app in device B. This device has only one Google account, the same as device B.
In onCreate() we will launch PlusClient#connect()
As the same Google account previously granted the same set of permissions/scope in another device, onConnected() will be called.
In the previous sequence, the point 7 does not happen. The immediate connection won't never happen. It is true that if I do mLastConnectionResult.startResolutionForResult() it will connect without asking the same permissions again, but the connection triggered from onCreate will result in an onConnectionFailed() if the app has been just installed.
I'm not sure if i'm getting it wrong and it just is not meant to work like that (but that is what I understood from the video), or it is just not working as expected.
Any help will be much appreciated.
Thank you.
NOTES: - the app is properly set up in google play developers console - I'm requesting exactly the same scope in the two different clients, as it is actually the same app - both devices has only one Google account. - I'm running this experiment using the sample app in github