I'm on Galaxy S III with Android 4.0.4, Google
Play installed.
In my app I try to get a token from the Google
Play services, as described on https://developers.google.com/android/google-play-services/authentication. Since it's all quite new (the Google pages were last updated this week), there's not much documentation to be found, especially about each specific error code.
final String token = GoogleAuthUtil.getToken(this, "
[email protected]", "scope");
gives me an exception:
09-30 11:24:36.075: ERROR/GoogleAuthUtil(11984): GooglePlayServices not available due to error 1
09-30 11:24:36.105: ERROR/AuthTokenCheck_(11984): Error 1
com.google.android.gms.auth.GooglePlayServicesAvailabilityException: GooglePlayServicesNotAvailable
at com.google.android.gms.auth.GoogleAuthUtil.f(Unknown Source)
at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)
at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)
at mobi.app.activity.AuthTokenCheck.getAndUseAuthTokenBlocking(AuthTokenCheck.java:148)
at mobi.app.activity.AuthTokenCheck$1.doInBackground(AuthTokenCheck.java:61)
at android.os.AsyncTask$2.call(AsyncTask.java:264)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
at java.util.concurrent.FutureTask.run(FutureTask.java:137)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
https://developers.google.com/android/google-play-services/reference/com/google/android/gms/auth/package-summary tells me:
GooglePlayServicesAvailabilityExceptions are special instances of
UserRecoverableAuthExceptions which are thrown when the expected
Google
Play services app is not available for some reason.
But what exactly does that mean? And how to resolve it? I've added the Google
Play services extras in my SDK and the jar to my project, marked as 'exported'.
I'm also wondering what the "Google
Play services app" exactly is. Unfortunately it's all not very clearly described at https://developers.google.com/android/google-play-services/.
The Google
Play services component is delivered as an APK through the
Google
Play Store, so updates to Google
Play services are not
dependent on carrier or OEM system image updates. Newer devices will
also have Google
Play services as part of the device's system image,
but updates are still pushed to these newer devices through the Google
Play Store.
Isn't "Google
Play services" app the same as the "Google
Play" app?
Another question I have, due to lack of documentation: what is the scope parameter for?
The documentation just says the following, but not defining what an 'authentication scope' exactly is:
scope String representing the authentication scope.