1. Hey! Guest! The 32nd GMC Jam will take place between Feb 22nd, 12:00 UTC (Friday noon) and Feb 25th, 12:00 UTC (Monday noon). Why not join in! Click here to find out more!
    Dismiss Notice

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

Discussion in 'GameMaker Studio 2 Community Tech Support' started by matharoo, Sep 24, 2018.

  1. matharoo

    matharoo Udemy Instructor

    Joined:
    Jul 9, 2016
    Posts:
    804
    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?
     
  2. The Shatner

    The Shatner Member

    Joined:
    Jun 25, 2016
    Posts:
    116
    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 likes this.
  3. matharoo

    matharoo Udemy Instructor

    Joined:
    Jul 9, 2016
    Posts:
    804
    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.
     
  4. The Shatner

    The Shatner Member

    Joined:
    Jun 25, 2016
    Posts:
    116
    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.
     
  5. matharoo

    matharoo Udemy Instructor

    Joined:
    Jul 9, 2016
    Posts:
    804
    Tried all of that. Still the same. :/
     
  6. matharoo

    matharoo Udemy Instructor

    Joined:
    Jul 9, 2016
    Posts:
    804
    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.
     
  7. matharoo

    matharoo Udemy Instructor

    Joined:
    Jul 9, 2016
    Posts:
    804
    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: Sep 27, 2018
  8. Carsten

    Carsten Member

    Joined:
    Nov 25, 2016
    Posts:
    24
    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
     
  9. matharoo

    matharoo Udemy Instructor

    Joined:
    Jul 9, 2016
    Posts:
    804
    Did you do everything suggested in posts #2 and #4?
     
  10. Mert

    Mert Member

    Joined:
    Jul 20, 2016
    Posts:
    196
    I started seeing this issue. It was all working fine up until I decided to change a picture for the achievement icons..
    Any suggestions ?
     
  11. matharoo

    matharoo Udemy Instructor

    Joined:
    Jul 9, 2016
    Posts:
    804
    Are you using version 2.9.0 of the extension?
     
  12. Mert

    Mert Member

    Joined:
    Jul 20, 2016
    Posts:
    196
    Now it's back to normal, everything works normal now
     
    matharoo likes this.
  13. Nanuk Codes

    Nanuk Codes Member

    Joined:
    Feb 11, 2019
    Posts:
    1
    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...
    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?
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice