By: James | August 10, 2015


Part of the work I have been doing lately is creating custom pages for the pages in Google Play Games. This includes the Achievements, Leaderboards, Load Game, Player Se, Player Selection, etc. The plan is to create them with the same look and theme of my apps but maintain rough feature equivalence. It was going fairly well until it came down to a feature of the Leaderboards viewer. There was a simple button to let you compare your profile with that of another player. I found no documentation whatsoever regarding how to build an intent to do this.


My initial search found this question on Stack Overflow. It wasn't exactly what I was asking for but it was close. Of course there was no answer. I eventually gave up my online search and went a bit more technical.

The first step was to look at the logcat when launching the intent from the Google version of the leaderboards page. That gives me this

{ flg="0x10008000" cmp="" (has extras)}

Which then launches

{ flg="0x50000000" cmp="" (has extras)}

So now I had the proper activity within Google Play Games to launch. I again tried some online searching about it and came up with nothing. I finally took a more drastic approach and ran a decompiler on the app itself to see if I could find anything and find something I did. I found how to deep link into Google Play Games to pretty much any useful page. There was essentially a big switch statement for all the different pages. I walked through each one and wrote out my code for them all. The game about page, achievements, leaderboards, specific leaderboard, players, quests, profile, profile compare, and inbox.


View Gist on Github

The code in the gist is a working example of how to launch any page. There are "Magic" numbers that I found in the source code for each page. I tested across several versions of Google Play Games and they all work the same so hopefully they won't change. I did not find where they are defined.

To use just build an intent with buildDeepLinkIntent and then pass that intent to any of the page builders such as intentAbout and finally start it with startGooglePlayGames

Note that you may need to add in some additional error handling. This is an example only.


Be the first to comment ...

Post a Comment