How to display a leaderboard with google play game services?
Asked Answered
M

2

16

I have a game set up and connected in the developer console. Login works, submitting scores to the leaderboard works as well.

Now I simply don't understand the instructions on displaying the leaderboard https://developers.google.com/games/services/android/leaderboards#displaying_a_leaderboard

the sample code is:

startActivityForResult(mGamesClient.getLeaderboardIntent(LEADERBOARD_ID), REQUEST_LEADERBOARD);

where everything is fine but what does the constant REQUEST_LEADERBOARD stand for, or where is it defined if it already exists?

Thanks

EDIT: I should not have skipped the achievements-tutorial where it says: In the example, REQUEST_ACHIEVEMENTS is an arbitrary integer that you define as the request code. So I assume that the same applies to the integer REQUEST_LEADERBOARD.

EDIT 2: It is an arbitrary integer that you define as the request code and works fine.

Microscopy answered 17/5, 2013 at 15:50 Comment(0)
M
13

The request code REQUEST_LEADERBOARD is indeed an arbitrary int that you define by yourself.

You can use it in the notification method onActivityResult(int requestCode, int resultCode, Intent data) of your activity to get notified of the result of the intent.

Melgar answered 15/6, 2013 at 8:54 Comment(0)
M
0

just define any int example REQUEST_LEADERBOARD = 100;

Malinda answered 25/11, 2014 at 21:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.