Integrating Google Play Games
-
Upload
platty-soft -
Category
Technology
-
view
1.687 -
download
0
description
Transcript of Integrating Google Play Games
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 GameClient
AndroidManifest
<meta-data android:name="com.google.android.gms.games.APP_ID" android:value="@string/app_id" />
GameUtils
https://github.com/playgameservices/android-samples/tree/master/BasicSamples/libraries/BaseGameUtils/src/main
● GameBaseActivity● GameHelper <- It is over 1,000 lines of code
Signing In
{...beginUserInitiatedSignIn();...
}
@Overridepublic void onSignInSucceeded() {
...}
The GamesClient object is used to communicate with the Google Play service.
GamesClient
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
Questions?
Thanks!