Update:
Just now I signed up to Google API with the Google account I'm also using for the Google App Engine and now the error has changed to com.google.android.gms.auth.GoogleAuthException: Unknown
Google just released a new way to sign up to one's app via a Google Account and has given some explanation in their blogpost, too.
I'm writing an Android app you have to sign up for to create a user account and I'm using Google App Engine for the back end. With the play services, I want to get the users email affiliated with their Android device and a token. I can already get the email, however, getting the token only throws errors and due to the documentation being quite sparse, I don't know how to fix these. That's how I get the email:
private String[] getAccountNames() {
mAccountManager = AccountManager.get(this);
Account[] accounts = mAccountManager.getAccountsByType(GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE);
names = new String[accounts.length];
for (int i = 0; i < names.length; i++) {
names[i] = accounts[i].name;
}
return names;
}
However, when I'm calling token = GoogleAuthUtil.getToken(context, email,
"scope"
, it gives me these errors:
GooglePlayServices not available due to error 1
and com.google.android.gms.auth.GooglePlayServicesAvailabilityException: GooglePlayServicesNotAvailable
.
Now my question is, do I have to set any permissions or include any libraries to fix that? And what is the scope parameter? An example for how to get a token and what to put in for scope is given in their blogpost to set the scope variable to "https://www.googleapis.com/auth/userinfo.profile"
but I still get the same error unfortunately.
I also registered my app for the Google API console and enabled the G+ API, do I have to configure something else there, too?