I'm trying to make games API work, with reference to https://github.com/playgameservices/android-samples/blob/master/BaseGameUtils/src/com/google/example/games/basegameutils/BaseGameActivity.java as sample code.
Mine is quite similar, basically I'm trying to connect a game client and receive a negative answer. When trying to manage it with startResolutionForResult() this is what I got:
E/Volley(15638): [1492] il.a: Unexpected response code 403 for https://www.googleapis.com/games/v1/players/112370814111712506xxx
E/Volley(15638): [1492] il.a: Unexpected response code 403 for https://www.googleapis.com/games/v1/players/112370814111712506xxx
E/SignInIntentService(15638): Access Not Configured
[...]
E/LoadSelfFragment(15748): Unable to sign in - application does not have a registered client ID
The last message, "application does not have a registered client ID" made me think to this question...But I don't think my issue is related to app id / client ID as I got it working with same API keys on another machine. I'm pretty sure of SHA1 correctness, too, derived from current machine's debug.keystore.
The issue seems to be related to test address I'm using, the strange thing is that I don't receive always the same reply: using same keys and settings, I sometimes got:
E/SignInIntentService(15638): Access Not Configured
or even:
E/SignInIntentService(15638): Unable to load player
I'm using startResolutionForResult()
inside OnConnectionFailedListener, it's showing the log-in screen briefly, but then it crashes with reported errors.
Another strange thing is that onActivityResult() is called, and result code is 10004
A last thing I can't understand is why, after an unsuccessful sign-in, the method onConnectionFailed() is called over and over, looping my app. Relevant code is:
public void initClient() {
GamesClient.Builder gcBuilder = new GamesClient.Builder(this, cb, cf);
gcBuilder.setGravityForPopups(Gravity.TOP | Gravity.CENTER_HORIZONTAL);
//gcBuilder.setScopes(mScopes);
mGamelient = gcBuilder.create();
mSchiacciameleView.setGameClient(gcBuilder.create());
}
OnConnectionFailedListener cf = new OnConnectionFailedListener() {
public void onConnectionFailed(ConnectionResult arg0) {
Log.e("Verme", "CONN FAIL:" + arg0.getErrorCode());
if (arg0.hasResolution()){
PendingIntent pendingIntent = arg0.getResolution();
//startResolutionForResult(SchiacciaMeleGame.this, 66);
try {
arg0.startResolutionForResult(me, ConnectionResult.SIGN_IN_REQUIRED) ;
} catch (SendIntentException e) {
Log.e("Verme", "Err in resolution", e);
}
}else{
Log.e("Verme", "NO RESOLUTION");
}
}
};
I've been messing with these libraries for two days. Frankly, I don't like the way Google is managing this; documentation is still incomplete and run-time behaviour seems a bit inconsistent (the exact same code is working on another machine, SHA1 is correct on both). Maybe it's my fault?
Thank you for replies