1

I have integrated the google play game services successfully and I am able to login successfully.

After the login, I want to show the achievements to the user using a button. I have done the following implementation in my code:

// Create the Google API Client with access to Plus and Games
        mGoogleApiClient = new GoogleApiClient.Builder(GameCentreActivity.this)
                .addConnectionCallbacks(this)
                .setGravityForPopups(Gravity.TOP | Gravity.CENTER_HORIZONTAL)
                .addOnConnectionFailedListener(this)
                .addApi(Plus.API).addScope(Plus.SCOPE_PLUS_LOGIN)
                .addApi(Games.API).addScope(Games.SCOPE_GAMES)
                .build();

        findViewById(R.id.sign_in_button).setOnClickListener(this);
        findViewById(R.id.sign_out_button).setOnClickListener(this);
        findViewById(R.id.show_achievements).setOnClickListener(this);

In the onclick() method, I have this:

  @Override
        public void onClick(View view) {
            // TODO Auto-generated method stub

            if (view.getId() == R.id.sign_in_button) {
                //beginUserInitiatedSignIn();
                // start the sign-in flow
                mSignInClicked = true;
                mGoogleApiClient.connect();
            }
            else if (view.getId() == R.id.sign_out_button) {
               // signOut();
               // findViewById(R.id.sign_in_button).setVisibility(View.VISIBLE);
               // findViewById(R.id.sign_out_button).setVisibility(View.GONE);
                // sign out.
                mSignInClicked = false;
                Games.signOut(mGoogleApiClient);
                if (mGoogleApiClient.isConnected()) {
                    mGoogleApiClient.disconnect();
                }
                showSignInBar();
            }
            else if (view.getId() == R.id.show_achievements){
               // startActivityForResult(Games.Achievements.getAchievementsIntent(mGoogleApiClient), 1);
                Log.d("Show achievements called","show_achievements");
                startActivityForResult(Games.Achievements.getAchievementsIntent(mGoogleApiClient),
                        REQUEST_ACHIEVEMENTS);
                Log.d("Show achievements ended","show_achievements");
            }   

        }

But the achievements are not displaying at all in my screen. Please help me in finding the solution.

Mahm00d
  • 3,881
  • 8
  • 44
  • 83
shobhan
  • 252
  • 3
  • 10
  • so what is showing in the screen? just blank? do you have logs? and did you define an achievement in the developer console? – goblin Dec 22 '15 at 07:48
  • Yes , I have defined the achievement in the developer console. it is just showing a blank screen – shobhan Dec 22 '15 at 08:32
  • have you tried to manually check if the achievement api returns the value you expected using the api explorer? https://developers.google.com/apis-explorer/#p/games/v1/games.achievements.list – goblin Dec 22 '15 at 10:29

1 Answers1

1

I resolved my problem , I didn't publish the game in developer console , after publishing the game am able to see the achievements in activity

shobhan
  • 252
  • 3
  • 10