Integrating Google Play Games

2,221 views
1,963 views

Published on

Step by step description on how to use Achievements and Leaderboards from Google Play Games in an Android game.

This was a 15 minutes session for the Dutch Android User Group on "Play Services"

Published in: Technology, Business
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,221
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
28
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Integrating Google Play Games

  1. 1. Achievements & Leaderboards Using Google Play Services
  2. 2. It is actually quite smooth
  3. 3. Setup
  4. 4. On the Developer Console
  5. 5. On the Developer Console
  6. 6. Next, next, next
  7. 7. On the Developer Console
  8. 8. On the Android Project ● Add google_play_services_lib ● Update the AndroidManifest ● Use GameUtils ● Interact with GameClient
  9. 9. AndroidManifest <meta-data android:name="com.google.android.gms.games.APP_ID" android:value="@string/app_id" />
  10. 10. GameUtils https://github.com/playgameservices/androidsamples/tree/master/BasicSamples/libraries/BaseGameUtils/src/main ● ● GameBaseActivity GameHelper <- It is over 1,000 lines of code
  11. 11. Signing In { ... beginUserInitiatedSignIn(); ... } @Override public void onSignInSucceeded() { ... }
  12. 12. GamesClient The GamesClient object is used to communicate with the Google Play service.
  13. 13. Achievements
  14. 14. On the Developer Console
  15. 15. New Achievement
  16. 16. On the Android Project ● Import the ids ● Unlock an Achievement ● Open the Achievement List
  17. 17. Unlock an Achievement getGamesClient().unlockAchievement(achievementId);
  18. 18. Show the Achievements startActivityForResult(getGamesClient() .getAchievementsIntent(), REQUEST_ACHIEVEMENTS);
  19. 19. Leaderboards
  20. 20. On the Developer Console
  21. 21. Configure the Leaderboard
  22. 22. On the Android Project ● Import the ids ● Submit a score ● Open a leaderboard ● Open the Leaderboards List
  23. 23. Submit a Score getGamesClient().submitScore(leaderboardId, points);
  24. 24. Open a Leaderboard startActivityForResult(getGamesClient() .getLeaderboardIntent(id), REQUEST_LEADERBOARDS);
  25. 25. Open All Leaderboards startActivityForResult(getGamesClient() .getAllLeaderboardsIntent(), REQUEST_LEADERBOARDS);
  26. 26. Not so smooth
  27. 27. If you forget the game_id it will just crash
  28. 28. Testing the integration The game needs to be signed for release
  29. 29. About “Game Features” They only appear after “some users” have used the features
  30. 30. Thanks! Questions?

×