- Home /
How do I prompt for login in the Social API? (GameCircle)
I am using the Social API with Amazon's GameCircle. The behavior I am seeing is if the player is not logged on, then this will prompt a brief banner for them to log on ("Welcome Guest, sign on to GameCircle"). But if they do not log on that time, every time afterwards I will get an authentication failed message so the player does not get another chance to try to log on unless they reload the game.
What I want to do is know how to prompt the user to log in again (with the same "Welcome Guest, sign on to GameCircle" message) if authentication fails. My understanding is if I call Social.localUser.Authenticate(callback) that it either succeeds or fails with an error. What I want to do is if it fails with an error, every so often, ask the user to sign into Amazon's system.
Earlier in my code I set:
Social.Active = GameCircleSocial.Instance;
Then to increment a score on the leaderboard do:
if (Social.localUser.authenticated) {
Social.ReportScore(1, LEADERBOARD_PROGRESS_ID, IncrementLeaderboardCallback);
} else {
Social.localUser.Authenticate (ProcessAuthentication);
}
And in process authenticate:
void ProcessAuthentication (bool success) {
if (success) {
Debug.Log ("Authenticated, checking achievements");
}
else
Debug.Log ("Failed to authenticate");
}