Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

just define any int example REQUEST_LEADERBOARD = 100;

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top