O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.
Achievements & Leaderboards

Using Google Play Services
It is actually quite smooth
Setup
On the Developer Console
On the Developer Console
Next, next, next
On the Developer Console
On the Android Project
●

Add google_play_services_lib

●

Update the AndroidManifest

●

Use GameUtils

●

Interact with ...
AndroidManifest

<meta-data android:name="com.google.android.gms.games.APP_ID"
android:value="@string/app_id" />
GameUtils
https://github.com/playgameservices/androidsamples/tree/master/BasicSamples/libraries/BaseGameUtils/src/main

●
...
Signing In
{
...
beginUserInitiatedSignIn();
...
}
@Override
public void onSignInSucceeded() {
...
}
GamesClient

The GamesClient object is used to communicate
with the Google Play service.
Achievements
On the Developer Console
New Achievement
On the Android Project
●

Import the ids

●

Unlock an Achievement

●

Open the Achievement List
Unlock an Achievement

getGamesClient().unlockAchievement(achievementId);
Show the Achievements

startActivityForResult(getGamesClient()
.getAchievementsIntent(), REQUEST_ACHIEVEMENTS);
Leaderboards
On the Developer Console
Configure the Leaderboard
On the Android Project
●

Import the ids

●

Submit a score

●

Open a leaderboard

●

Open the Leaderboards List
Submit a Score

getGamesClient().submitScore(leaderboardId, points);
Open a Leaderboard

startActivityForResult(getGamesClient()
.getLeaderboardIntent(id), REQUEST_LEADERBOARDS);
Open All Leaderboards

startActivityForResult(getGamesClient()
.getAllLeaderboardsIntent(), REQUEST_LEADERBOARDS);
Not so smooth
If you forget the game_id it will just crash
Testing the integration

The game needs to be
signed for release
About “Game Features”

They only appear after
“some users” have used
the features
Thanks!

Questions?
Integrating Google Play Games
Próximos SlideShares
Carregando em…5
×

Integrating Google Play Games

2.595 visualizações

Publicada em

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"

Publicada em: Tecnologia, Negócios
  • Seja o primeiro a comentar

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?

×