Search code examples
javaandroidandenginegoogle-play-services

Google Play Game Services - Custom Notification / Welcome Back


I have been looking all over the internet, but can't find my answer.

Is there a way to show the user that they are signed in to the GPGS. The first time you sign in you'll get a notification, what will say "Welcome < name >" But when you open the app the next time nothing is shown.

Is there a way to show a Welcome Back notification?
For iOS it is possible: noted just above Step 9: https://developers.google.com/games/services/ios/quickstart?hl=en#step_9_add_a_sign-out_button

Any ideas?


Solution

  • If you want the official Welcome Back Notification (the one that shows when a user is authenticated for the first time, or after having been signed out... not just disconnected), there are a few approaches that I use. (this is based on using the GameHelper Class as supplied by Google)

    1) When a user quits the game by actually using a control that tells me they have left because they wanted to quit (i.e. not because of a phone call interrupt, or user hits the home button) I have had my apps just sign out of Play Services. This causes the user to have to sign in the next time around (which you can either do for them programmatically, or use the Google Sign in button), which causes the "Welcome Back" to flash. (make sure you use a way to track that they were logged in, as I believe Google wants users to use a button to sign in, if they signed out on their own volition)

    2) I have forced the current sign in session to logout upon app startup, which means the same thing, user has to login (whether by app design or Google Button)

    3) On app startup, wait for the onSignInSucceeded (which is triggered, but no auto Welcome Back) and show your own "You are Still Signed In" Toast message.

    The part you mention above for iOS:

    If you run your application again, you should now see a "Welcome back!" notification when you start the game. This is being powered by the GPGManager. At this point, your application and Game services are authorized and ready to go! You're now ready to earn achievements, load save games from the cloud, display social leaderboards, and so on.

    Is actually implemented the same way for us... if your user hasn't been connected for a while, and their session has expired... the Welcome Back popup will be displayed when GameHelper re-initiates the connection (Something like 24 hours... I haven't done enough tests to find out exactly when Google tosses the current session credentials)