android - How do I programmatically launch the "Google Play Games Profile" Game Page -
i want directly launch google play game page game programmatically when player hits button game screen:
an example of page want launch is:
https://drive.google.com/file/d/0b8xfkv7sp0jzdzjiwwpfwg8znhoydnmzwkwzzvjwzdjuuxzr/view?usp=sharing
any thoughts/suggestions on doing this?
ps. i've taken random awesome game "badland" example :). hope that's okay!
it has been while don't know if found answer have been working on same thing today , figured share solution. found no sources on online , ended decompiling app @ expects intents launch it.
intent intent = new intent(); //clear activity button returns app intent.addflags(intent.flag_activity_clear_top); //manually specify package , activity name intent.setcomponent(new componentname("com.google.android.play.games", "com.google.android.gms.games.ui.destination.api.apiactivity")); //not needed default happens if don't specify it. intent.addcategory(intent.category_default); //you must specify current players user. ensures google play games logged in same person. intent.putextra("com.google.android.gms.games.account_key", games.players.getcurrentplayerid(googleapiclient)); intent.putextra("com.google.android.gms.games.screen", 1050); //"magic" number source code page intent.putextra("com.google.android.gms.games.game", games.gamesmetadata.getcurrentgame(googleapiclient)); startactivity(intent);
note page uses hard coded number. tested on several versions of google play games , worked still haven't found value defined. may want add in error handling cases such google play games not being installed.
Comments
Post a Comment