Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

Check if Google Play Services is available?

Discussion in 'Scripting' started by HeatWave_Games, Mar 1, 2018.

  1. HeatWave_Games

    HeatWave_Games

    Joined:
    Jun 3, 2016
    Posts:
    52
    Hi,

    I'm currently using the following line to authenticate the users on the Google Play Services:
    Social.localUser.Authenticate(success => { });


    But this wants to sign them in even if there is no internet connection.

    How could I check if they have internet connection and Google Play Services are available for sure?

    Thanks.
     
  2. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,140
    Chances are if it tries to sign them in and can't, it will return some error. You should handle this error and display some feedback to the player. I haven't used Google play services, so I couldn't tell you what they do for errors, but I'm sure they have examples somewhere.
     
  3. Fimiam

    Fimiam

    Joined:
    Oct 24, 2016
    Posts:
    11
    Yeah, this is really a problem, the game thinks that gpg is authenticated even without internet connection. Now I'm gonna try this ((PlayGamesPlatform)Social.Active).localUser.state == UnityEngine.SocialPlatforms.UserState.Offline)
     
  4. shadowthunder24

    shadowthunder24

    Joined:
    Jun 19, 2019
    Posts:
    8
    Any luck? I've been having the same problem as you Fimiam
     
  5. shadowthunder24

    shadowthunder24

    Joined:
    Jun 19, 2019
    Posts:
    8
    Problem is that the callback returns true. For example, say if I turned my network on and I authenticate to Google Play Services then lose internet connection for whatever reason, the call back will still return true when you authenticate again without a connection, when really it should be returning false.
     
  6. Fimiam

    Fimiam

    Joined:
    Oct 24, 2016
    Posts:
    11
    I don't remember this solved the issue, it was long ago, but I left my code like this and it still works