Milos Romanic
Milos Romanic

Reputation: 457

API exceptions when trying to integrate Google Play Games in my app

I have an app that is already published on Play Store and I wanted to integrate Google Play Games so I can have achievements but I keep getting an

com.google.android.gms.common.api.ApiException: 13:

whatever I try.

I have followed https://developers.google.com/games/services/android/quickstart, https://developers.google.com/games/services/android/signin and https://developers.google.com/games/services/console/enabling, with the rest of Googles documents.

I have a Game service on Google console which is linked to the app, which has a Firebase SDK and an API Console project. It has a linked Android app with an OAuth 2.0 Client. On the API Console project i have API keys and OAuth keys that are valid (checked them like 6 times). Google Play Games is enabled on the API Console project as well as Google Sign In Option on the Firebase (tried it just because I couldn't get it to work). I have my email added as a tester.

I have a google-services.json file that has a valid API key and a valid client id. In my AndroidManifest I have everything the docs said i need to have like gms.version and gms.games.APP_ID as well as play-services-auth and play-services-games in the gradle files as well as applying the google-services pluging and having maven for google and having the Google Play services SDK in Android Studio .

I tried with the default sign in way

GoogleSignInClient signInClient = GoogleSignIn.getClient(this,
            GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN);
    Intent intent = signInClient.getSignInIntent();
    startActivityForResult(mGoogleSignInClient.getSignInIntent(), 20);

As well as adding request scopes, requesting emails, tokens and building GoogleSignInOptions, as well as requesting server auth codes.

I handle it mostly like this, but i have tried it different ways.

if (requestCode == 20) {
        Task<GoogleSignInAccount> task =
                GoogleSignIn.getSignedInAccountFromIntent(data);
        try {
            GoogleSignInAccount account = task.getResult(ApiException.class);
            onConnected(account);
        } catch (ApiException apiException) {
            String message = apiException.getMessage();

I did try DEFAULT_SIGN_IN and was able to get the window to ask me for an account but then i get another API exception "10". No window will pop up, but it did before when I didn't have an updated Play Games version, so it asked me to update it.

It's been like a week now and i googled like hell. I don't think that SHA's are the problem as the game already works on the store but i have checked them.

If nothing, leave me some code to try with as i won't give up just yet ^^

Upvotes: 2

Views: 233

Answers (1)

Milos Romanic
Milos Romanic

Reputation: 457

I added my app_id to the resource folder and in My Manifest i went @string/app_id, and now a got a SUCCESS from the Api, will test further to see if results are valid.

Upvotes: 1

Related Questions