android - Unable to submitscore or show leaderboard although I am able to sign in to Google+ successfully -


in activity: public class menuactivity extends activity implements connectioncallbacks, onconnectionfailedlistener

and once connected google+, try calling leaderboard. (just testing)

@override public void onconnected(bundle bundle) {          try{             startactivityforresult(games.leaderboards.getleaderboardintent(mgoogleapiclient,'myactual_leaderboard_id'), request_leaderboard);         } catch (exception e){          }     }   } 

startactivityforresult throws nullpointerexception. required api not requested.

in manifest.xml

  meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />   <meta-data android:name="com.google.android.gms.games.app_id" android:value="@string/app_id" /> 

i have added numeric app_id string in string.xml.

game details in "ready test" state.

does has idea why happening?

my mistake.

realized have missed out declaration in mgoogleapi. both statement below missing.

.addapi(games.api) .addscope(games.scope_games)

problem solved after have added them. full declaration as:

mgoogleapiclient = new googleapiclient.builder(this)             .addconnectioncallbacks(this)             .addonconnectionfailedlistener(this).addapi(plus.api, null)             .addapi(games.api)             .addscope(games.scope_games)             .addscope(plus.scope_plus_login).build(); 

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -