I have a simple game, with a leaderboard button, it shows the top score of the player, before posting this question, i have made sure about the following :
- SHA1 Fingerprint.
- APIs enabled.
- Correct Package.
- Correct App ID.
- Google Play Service libs imported and added.
- Config file imported.
- Admob, Analytics and crash reports are working fine.
- GET ACCOUNTS already added, still the same.
My problem is, no Account chooser/picker is showing, and it's not even signing in, im getting the following error :
ConnectionResult{statusCode=SIGN_IN_REQUIRED, resolution=PendingIntent{fbd982b: android.os.BinderProxy@b3d396d}, message=null
Code :
public class MainActivity extends AppCompatActivity implements
GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
ImageButton mLeaderBoard;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_welcome);
mLeaderBoard = (ImageButton) findViewById(R.id.leaderboard);
mLeaderBoard.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ShowBoard();
}
});
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(Games.API)
.addScope(Games.SCOPE_GAMES)
.addScope(SCOPE_PLUS_PROFILE)
.build();
}
@Override
protected void onStart() {
super.onStart();
mGoogleApiClient.connect();
}
@Override
protected void onStop() {
super.onStop();
if (mGoogleApiClient.isConnected()) {
mGoogleApiClient.disconnect();
}
}
private void ShowBoard() {
if(!isSignedIn()){
mGoogleApiClient.connect();
}
mGoogleApiClient.connect();
if(isSignedIn())
startActivityForResult(Games.Leaderboards.getLeaderboardIntent(mGoogleApiClient,
LEADERBOARD_TOP_SCORE_ID), 1);
else
Toast.makeText(this, getResources().getString(R.string.leaderboard_not_available), Toast.LENGTH_LONG).show();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// Check which request we're responding to
if (requestCode == 1) {
Log.i("GoogleSignInApi","Result: " + resultCode + " - Data: " + data.getData());
if (resultCode == RESULT_OK) {
}
}
}
@Override
public void onConnected(Bundle bundle) {
}
@Override
public void onConnectionSuspended(int i) {
mGoogleApiClient.connect();
}
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
Log.i("GoogleSignInApi","Problem: " + connectionResult.getErrorMessage() + " - Test: " + connectionResult.toString());
}
}