• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Android Google Play Services - "Games.API is not available on this device"

matharoo

manualman
GameMaker Dev.
I'm trying to implement leaderboards into my Android game, using the GPS extension by YoYo Games. It seems to log in, but can't fetch the leaderboard using achievement_show_leaderboards().

Code:
09-24 20:36:12.714  4027  4064 I yoyo    : Achievement available: 1
09-24 20:36:12.716  4027  4027 I yoyo    : Attempting to show leaderboards.
09-24 20:36:13.565  4027  4027 I yoyo    : Failed to show leaderboards: com.google.android.gms.common.api.ApiException: 17: API: Games.API is not available on this device.
Achievement system is available (checked using achievement_available()) but it says that I don't have the Games API.

Googling it didn't yield any results. How can I fix this?
 
T

The Shatner

Guest
Hey there!
I'm not sure what causes that problem, but here goes a few things I'd try:
1 - Executing the game from an actual device instead of an emulator or the GMS Virtual Machine;
2 - Compiling the game, uploading it and sending it to the Play Store as an Alpha Version;
3 - Double-checking how the Play Console is configured - there might be something missing there, such as publishing your leaderboard or giving yourself access as a tester (if the leaderboard is still a draft);
4 - Redownloading the Google Play Extension.
5 - Double-checking the Android Configurations (or Global Game Settings, if on GMS 1.4) to see if you've enabled the use of the Google Services API.

Try these out and give us a shout as to if it worked.
 

matharoo

manualman
GameMaker Dev.
Hey there!
I'm not sure what causes that problem, but here goes a few things I'd try:
1 - Executing the game from an actual device instead of an emulator or the GMS Virtual Machine;
2 - Compiling the game, uploading it and sending it to the Play Store as an Alpha Version;
3 - Double-checking how the Play Console is configured - there might be something missing there, such as publishing your leaderboard or giving yourself access as a tester (if the leaderboard is still a draft);
4 - Redownloading the Google Play Extension.
5 - Double-checking the Android Configurations (or Global Game Settings, if on GMS 1.4) to see if you've enabled the use of the Google Services API.

Try these out and give us a shout as to if it worked.
Still the same...

Thanks though

Edit: There's one thing: While the app itself is published as alpha, the google play services side is not published. But it is on testing mode and I am entered as a tester. I can even log in to the game, it's just the achievements and leaderboards that are not working.
 
T

The Shatner

Guest
Still the same...

Thanks though

Edit: There's one thing: While the app itself is published as alpha, the google play services side is not published. But it is on testing mode and I am entered as a tester. I can even log in to the game, it's just the achievements and leaderboards that are not working.
Well... That's odd.
I'll tell you what worked for me, and maybe we can find out what's wrong...

In the very first object created, in the CREATE event:
Code:
if !achievement_login_status()
   {
   achievement_login();
   }
This shows the Google Play Games splash screen and logs into it (which is mandatory in case you want to use Google Play Services in the form of Leaderboards and Achievements).

To open up the Leaderboards screen I have a dedicated instance. Here goes its code:
LEFT RELEASE event:
Code:
            if achievement_available()
                {
                achievement_show_leaderboards();
                }
            else
                {
                if !achievement_login_status()
                    {
                    achievement_login();
                    }
                }
Also, I read somewhere that sometimes you have to get the other Google Extensions (such as GooglePlayLicensingAsExt and GooglePlayServicesIAPExtension) in order for the base GPS extension to work properly.
It could also be something with the permissions... Are you giving the game permission to access Internet and Network State? There's also an age-old weird behavior that "forces" you to enable the Bluetooth permission in order to get non-Bluetooth related things to function.

There's also the possibility that Google still hasn't updated the changes you've made in the Developer Console - Game Services. Sometimes it's instant, but at times it can take up to a day before it's complete. In my case, I had to publish it, because it didn't work (or it would take too long) as a draft, even though I was registered as a tester.
 

matharoo

manualman
GameMaker Dev.
Well... That's odd.
I'll tell you what worked for me, and maybe we can find out what's wrong...

In the very first object created, in the CREATE event:
Code:
if !achievement_login_status()
   {
   achievement_login();
   }
This shows the Google Play Games splash screen and logs into it (which is mandatory in case you want to use Google Play Services in the form of Leaderboards and Achievements).

To open up the Leaderboards screen I have a dedicated instance. Here goes its code:
LEFT RELEASE event:
Code:
            if achievement_available()
                {
                achievement_show_leaderboards();
                }
            else
                {
                if !achievement_login_status()
                    {
                    achievement_login();
                    }
                }
Also, I read somewhere that sometimes you have to get the other Google Extensions (such as GooglePlayLicensingAsExt and GooglePlayServicesIAPExtension) in order for the base GPS extension to work properly.
It could also be something with the permissions... Are you giving the game permission to access Internet and Network State? There's also an age-old weird behavior that "forces" you to enable the Bluetooth permission in order to get non-Bluetooth related things to function.

There's also the possibility that Google still hasn't updated the changes you've made in the Developer Console - Game Services. Sometimes it's instant, but at times it can take up to a day before it's complete. In my case, I had to publish it, because it didn't work (or it would take too long) as a draft, even though I was registered as a tester.
Tried all of that. Still the same. :/
 

matharoo

manualman
GameMaker Dev.
Uploaded the app as alpha, published it, waited for the update to be available, then downloaded the app via Play Store, and the leaderboards work!

I did everything Shatner recommended, and I also changed the API build level to 28 via the drop-down menu in Android settings. So I'm not sure specifically what it was that fixed it, but I'm glad it's working.
 

matharoo

manualman
GameMaker Dev.
nvm, fixed with 2.9.0
---
I've ran into another issue.

If I use achievement_show_leaderboards(), the leaderboard window opens but closes instantly. So you can't actually access the leaderboard.

Here are the relevant logs:

09-27 19:38:20.481 30768 30824 I yoyo : Achievement available: 1
09-27 19:38:20.504 30768 30768 I yoyo : Attempting to show leaderboards.
09-27 19:38:20.531 30768 30768 I yoyo : Showing leaderboards.
09-27 19:38:20.635 30768 30824 I yoyo : vsync timeout...
09-27 19:38:20.671 30768 30768 I yoyo : onWindowFocusChanged(false|false)
09-27 19:38:20.672 30768 30768 I yoyo : Setting vis flags to 5894
09-27 19:38:20.692 30768 30768 I yoyo : onPause
09-27 19:38:20.697 30768 30768 I yoyo : Pausing the Runner
09-27 19:38:20.785 30768 30824 I yoyo : vsync timeout...
09-27 19:38:21.176 30768 30768 I yoyo : Setting vis flags to 5894
09-27 19:38:21.908 30768 30768 I yoyo : Setting vis flags to 5894
09-27 19:38:22.411 30768 30768 I yoyo : Setting vis flags to 5894
09-27 19:38:23.228 30768 30768 I yoyo : Got activity result: 10001
09-27 19:38:23.242 30768 30768 I yoyo : BILLING: Request code not found 5011
09-27 19:38:23.271 30768 30768 I yoyo : gps onActivityResult called. RequestCode: 5011. ResponseCode: 10001

09-27 19:38:23.271 30768 30768 I yoyo : onActivityResult called with 5011
09-27 19:38:23.272 30768 30768 I yoyo : Setting vis flags to 5894
09-27 19:38:23.272 30768 30768 I yoyo : End Got activity result

Thanks.
 
Last edited:

Carsten

Member
Hey @matharoo, I'm having the same problem (cannot find Games API) since I created a new oAuth Client ID because I previously couldn't log into google play. Uploading the game to the google play store (as internal test) and then installing it didn't solve the problem. Do you have any other ideas how to solve this? I cannot access the leaderboards.

Thanks, Carsten
 

matharoo

manualman
GameMaker Dev.
Hey @matharoo, I'm having the same problem (cannot find Games API) since I created a new oAuth Client ID because I previously couldn't log into google play. Uploading the game to the google play store (as internal test) and then installing it didn't solve the problem. Do you have any other ideas how to solve this? I cannot access the leaderboards.

Thanks, Carsten
Did you do everything suggested in posts #2 and #4?
 

Mert

Member
I started seeing this issue. It was all working fine up until I decided to change a picture for the achievement icons..
Any suggestions ?
 
N

Nanuk Codes

Guest
Hey! I've been fighting with all these problems you guys mentioned for the last week... After following all of your advice I made a little mistake, which was enabiling the READ_PHONE_STATE permission...
There's also an age-old weird behavior that "forces" you to enable the Bluetooth permission in order to get non-Bluetooth related things to function.
Now every time I try to upload a new build of the game apk this error message promts up: Your APK or Android App Bundle uses permissions that require a privacy policy: (android.permission.READ_PHONE_STATE).
I deactivated the tab that asked for these permissions and the same error message appears. Any idea?
 
S

Shyler

Guest
have you been able to solve the problem? because it's the same with me
 

sman

Member
Same problem for me: the leaderboard window opens but closes instantly. Do you have a solution?
Using 2.9.0
 

RyanC

Member
anyone know if its possible to fix in GMS 1.4?
My game is currently being featured in Early Access (US, UK only) and my Leaderboards and IAP's go down on the same day!
 
Can anyone tell me whether the achievement_show_leaderboards() and the achievement_show_achievements() are working on GM14?

the google splash screen does not appear to me. And also when you win an achievement it is activated because it does not appear on the screen. :(
 
Top