Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Google Play Services - Sign In results in absolutely nothing . . .

Discussion in 'Android' started by Thaxxel, Feb 19, 2018.

  1. Thaxxel

    Thaxxel

    Joined:
    Jan 14, 2014
    Posts:
    8
    Hey all,

    So I have been recently trying to add Google Play Game Services to a project my buddy and I are working on.

    I figured I would start with the sign in, as that is necessary for anything else that we wanted to add like achievements and leaderboards.
    Anyway, I have published a closed Alpha to the google play store with my buddies dev and my own dev emails as the testers. I have set up my OAuth2 Client ID, SHA 1, AndroidManifest file, and other Game Services we are hoping for.

    I then in Unity included the most recent Google Play Games Plugin (0.9.50), and set up the Resources and Client ID into our project. I of course have my Key and such for a Signed APK for our Closed Alpha test.

    I then set up a button for Sign In within our scene, and have my code set up as follows:

    Code (CSharp):
    1.     void Start ()
    2.     {
    3.         PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
    4.             .RequestEmail()
    5.             .RequestServerAuthCode(false)
    6.             .RequestIdToken()
    7.             .Build();
    8.  
    9.         //DEBUGGING ONLY
    10.         PlayGamesPlatform.DebugLogEnabled = true;
    11.  
    12.         PlayGamesPlatform.InitializeInstance(config);
    13.         PlayGamesPlatform.Activate();
    14.  
    15.         // Does nothing either . . . .
    16.        Social.Instance.Authenticate((bool success) => { SignInCallback(success); }, false);
    17.     }
    18.  
    19.     public void SignIn()
    20.     {
    21.         _signInNotification.text = "WARMER";
    22.  
    23.         if (!PlayGamesPlatform.Instance.localUser.authenticated)
    24.         {
    25.             _signInNotification.text = "SIGNING IN";
    26.             Social.localUser.Authenticate((bool success) => { SignInCallback(success); });
    27.         }
    28.         else
    29.         {
    30.             PlayGamesPlatform.Instance.SignOut();
    31.  
    32.             _signInNotification.text = "OUT";
    33.         }
    34.     }
    35.  
    36.     private void SignInCallback(bool success)
    37.     {
    38.         if (success)
    39.         {
    40.             Debug.Log("(Something) Signed in!");
    41.  
    42.             _signInNotification.text = "Signed In as : " + Social.localUser.userName;
    43.         }
    44.         else
    45.         {
    46.             Debug.Log("(Something) Sign-In Failed!");
    47.  
    48.             _signInNotification.text = "Sign-In Failed!";
    49.         }
    50.     }
    I have some text that lets me know what part of the code was accessed or run. The sign in button calls the SignIn() function, but only the text 'WARMER' is shown. The Social.localUser.Authenticate() function never seems to be called.

    I have tried multiple solutions, changes, variations, etc. However when I click the SignIn button, absolutely nothing happens. No error, no warnings, no text saying Sign-In Failed, nothing.

    Not quite sure what I am missing, any ideas would be greatly appreciated! :)
     
  2. peaceofmind1188

    peaceofmind1188

    Joined:
    Nov 10, 2017
    Posts:
    1
    Did you find a solution? I am at the same point. Did multiple restarts, following multiple tutorials multiple times. Seems like everywhere people point to either SDK problems, changing the API console certificate to the upload certificate, or adding testers. I have played with every possibility with the above. When running the alpha from build and run or through the app store, when I press connect, no google sign in pops up.
     
  3. abojhra

    abojhra

    Joined:
    Nov 11, 2016
    Posts:
    3
    Same here
    Im tired:(
     
  4. abojhra

    abojhra

    Joined:
    Nov 11, 2016
    Posts:
    3
    Do find any sloution
     
  5. TheHgang

    TheHgang

    Joined:
    Oct 18, 2017
    Posts:
    5
    hey same problem here i am about to dieeeee
    nothing happens not even a glimpse of something someone pls find soln
     
  6. ematsuno

    ematsuno

    Joined:
    Oct 13, 2015
    Posts:
    27
    jeez, is this just broken?

    I've been at this for three weeks.

    is there anyone out there with a successful Saved Game with google play?

    I'm ready to punt. This is impacting our bottom line, where's the instruction or even error messages?
     
  7. vladk

    vladk

    Joined:
    Jul 10, 2008
    Posts:
    167
    Same thing here.

    Even if I do something like this:

    Code (CSharp):
    1. try
    2.         {
    3.             Social.localUser.Authenticate((bool success) =>
    4.             {
    5.                 if (success)
    6.                     ((PlayGamesPlatform)Social.Active).SetGravityForPopups(Gravity.TOP);
    7.             });
    8.         }
    9.         catch (Exception e)
    10.         {
    11.             UIPrimeController.Instance.GoWarning(e.ToString(), 30f);
    12.         }
    where "GoWarning" is my own tool for showing text on a mobile it shows nothing. It's never called, so it's not an exception. Something inside Authenticate method fails to even call an authentication routine and quits without ever calling a callback action :(
     
  8. pasanm2

    pasanm2

    Joined:
    Jun 20, 2018
    Posts:
    3
    I ran to the same problem. Plz help
     
  9. vladk

    vladk

    Joined:
    Jul 10, 2008
    Posts:
    167
    Try to update your Google Play Games and Google Play Services (I mean on your device, the one you use to test your application).
     
  10. abojhra

    abojhra

    Joined:
    Nov 11, 2016
    Posts:
    3
    When i use admob and googleplaygames service plugin i got error while buliding
    I got this mssage
    Win32 error pipe broken path
     
  11. Keyserjaya99

    Keyserjaya99

    Joined:
    Nov 17, 2016
    Posts:
    10
    Try update your JDK
     
  12. Keyserjaya99

    Keyserjaya99

    Joined:
    Nov 17, 2016
    Posts:
    10
    1. PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
    2. .RequestEmail()
    3. .RequestServerAuthCode(false)
    4. .RequestIdToken()
    5. .Build();

    6. //DEBUGGING ONLY
    7. PlayGamesPlatform.DebugLogEnabled = true;

    8. PlayGamesPlatform.InitializeInstance(config);
    9. PlayGamesPlatform.Activate();
    Change to:
    PlayGamesPlatform.Activate();

    Just it, it works for me.
     
    Jonas_F likes this.
  13. pasanm2

    pasanm2

    Joined:
    Jun 20, 2018
    Posts:
    3
    I exported the project in to android studio and built from there. Now it is working fine. I dont know what causes the problem.May be something wrong with the unity gradle build.
    BTW thanks for the reply
     
  14. farazk86

    farazk86

    Joined:
    May 31, 2017
    Posts:
    194
    Hi,

    I'm reviving this old topic because I am having the exact same issue OP is having and I have done everything OP has mentioned. And also there does not seem to be any solution posted yet.

    I have the signin functionality attached to a button but clicking on it does absolutely nothing.. the OAth box doesnt show up, nothing happens.

    does anyone know how to fix this?

    Thanks
     
  15. pamun

    pamun

    Joined:
    Nov 6, 2015
    Posts:
    1
    I had exactly same issue on last year.
    After call authenticate function, nothing happened, even no error log.

    And now it's solved!
    But I don't know what was the problem exactly bcuz I tried many things together.
    There is just what i did.

    1. Updated Unity version to 2019.2.12f1
    I started my project with 2017.3.1. My problem started here.
    To try to fix it, I updated to 2018.2.3 but still not solved (It was last year)
    Few days ago, I suddenly wanna try to fix it again so I updated to 2019.2.12 again. (Current version)
    version 2019.2 recommend you to include JDK, SDK, NDK, Gradle in Unity then I did.
    It takes long time to install everything again.

    2. Updated GPGS version to 0.10.6
    I deleted old one and imported new one.
    https://github.com/playgameservices/play-games-plugin-for-unity

    3. Linked app twice and Create Three of OAuth 2.0 client IDs
    On Google Play Console - Game Service - Linked Apps page,
    I linked my app twice using "App signing certificate" and "Upload certificate".
    (So created two of different OAuth 2.0 client IDs)
    and in the Google API Console(https://console.developers.google.com/), I created credentials type of web application too.
    I used it for Web Application ID (optional) in Google Play Game Setup in Unity.
    So I got totally three of OAuth 2.0 client IDs.
    I'm not sure if it's right way to do but I just wanted to do everything what I can do to fix.

    When I did until here, my problem still happened. Nothing changed yet.

    4. Build APK when GPGSUpgrader error is not happened.
    When I play my game in Unity debug mode, Sometimes GPGSUpgrader error appeared but not always.
    This error occurred on "AssetDatabase.Refresh();" in GPGSUpgrader.cs
    It happens sometimes and it disappears when I restart Unity.
    After I restart Unity, I play my game to check if any error log appear.
    When there is no error log, I build APK. Then it works!!

    I'm not sure what is right way exactly but my problem solved with them.
    I hope it can work for you too.
     
    truongpd88 and farazk86 like this.
  16. Gemons4Ever

    Gemons4Ever

    Joined:
    May 16, 2020
    Posts:
    4
    I seem to have issues with this:
    Code (CSharp):
    1. PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
    2.             .RequestServerAuthCode(false)
    3.             .Build();
    4. PlayGamesPlatform.InitializeInstance(config);
    5. PlayGamesPlatform.Activate();
    But this seems to work partially:
    Code (CSharp):
    1. PlayGamesPlatform.Activate();
    2.         PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
    3.             .RequestServerAuthCode(false)
    4.             .Build();
    5.         PlayGamesPlatform.InitializeInstance(config);
    But I guess because I call.Activate() before the config its not configured to return Server Authentication Codes and so it always returns null on
    Code (CSharp):
    1. authCode = PlayGamesPlatform.Instance.GetServerAuthCode();
    Has anybody an idea on how to solve this. Tried updating all libraries, force rebuild all dependencies ...

    I would appreciate any help.

    Thx.
     
  17. Rodolfo-Rubens

    Rodolfo-Rubens

    Joined:
    Nov 17, 2012
    Posts:
    1,197
    So, after around 6 hours trying to solve this I could connect and request the auth code (using RequestServerAuthCode on the builder) by changing the Client ID on the Google Play Games Setup plugin window in Unity for the one I created on the APIs page, the Client ID inserted there was the one for the Android Client instead of Web Client which was wrong. Using the Client ID of the Web Client credential (created on Google APIs page) and hitting Setup did the trick.
     
  18. Aryansh_Gupta

    Aryansh_Gupta

    Joined:
    Apr 9, 2020
    Posts:
    2
    I am in a similar problem, When ever I build and run the app, it shows Connecting to Google Play Games but then nothing happens, neither it connects to PlayGames
    Screenshot_2020-11-01-21-38-32-820.jpeg

    After this, nothing happens.
    I tried many tutorials but nothing works.
     
  19. kaarloew

    kaarloew

    Joined:
    Nov 1, 2018
    Posts:
    360
    Did you check out adb logcat for more precise error messages?
     
  20. KerimKa

    KerimKa

    Joined:
    Aug 3, 2017
    Posts:
    1
    I think this happens when you forgot to add your email account (used on your android phone) to the tester accounts on google play developer console and google play games services section
     
  21. vozcn

    vozcn

    Joined:
    May 15, 2019
    Posts:
    11
    I had the same problem, when I click login nothing was happening. For my case the problem was Proguard. I got error from android log cat :

    Error Unity AndroidJavaException: java.lang.ClassNotFoundException: com.google.android.gms.games.Games
    I fixed that by following the instructions here at the end of the page saying "Decreasing apk size". There is a custom Proguard configuration file, I used that.
    https://github.com/playgameservices/play-games-plugin-for-unity#decreasing-apk-size
    This is the proguard file I used :
    Code (CSharp):
    1. -keep class com.google.android.gms.games.leaderboard.** { *; }
    2. -keep class com.google.android.gms.games.snapshot.** { *; }
    3. -keep class com.google.android.gms.games.achievement.** { *; }
    4. -keep class com.google.android.gms.games.event.** { *; }
    5. -keep class com.google.android.gms.games.stats.** { *; }
    6. -keep class com.google.android.gms.games.video.** { *; }
    7. -keep class com.google.android.gms.games.* { *; }
    8. -keep class com.google.android.gms.common.api.ResultCallback { *; }
    9. -keep class com.google.android.gms.signin.** { *; }
    10. -keep class com.google.android.gms.dynamic.** { *; }
    11. -keep class com.google.android.gms.dynamite.** { *; }
    12. -keep class com.google.android.gms.tasks.** { *; }
    13. -keep class com.google.android.gms.security.** { *; }
    14. -keep class com.google.android.gms.base.** { *; }
    15. -keep class com.google.android.gms.actions.** { *; }
    16. -keep class com.google.games.bridge.** { *; }
    17. -keep class com.google.android.gms.common.ConnectionResult { *; }
    18. -keep class com.google.android.gms.common.GooglePlayServicesUtil { *; }
    19. -keep class com.google.android.gms.common.api.** { *; }
    20. -keep class com.google.android.gms.common.data.DataBufferUtils { *; }
    21. -keep class com.google.android.gms.games.quest.** { *; }
    22. -keep class com.google.android.gms.nearby.** { *; }
     
    kyxap likes this.
  22. kyxap

    kyxap

    Joined:
    Aug 20, 2021
    Posts:
    8
    Proguard and Logcat to the people! This fixes the issue! Thanks
     
  23. datsfain

    datsfain

    Joined:
    Nov 30, 2021
    Posts:
    1
    I had same problem callback was never called , now its fixed.
    Try This:
    1) Assets > External Dependency Manager > Android Resolver > Delete Resolved Libraries.
    2) Assets > External Dependency Manager > Android Resolver > Force Resolve
     
    vARDAmir88 likes this.
  24. saulo-carranza

    saulo-carranza

    Joined:
    Apr 9, 2021
    Posts:
    2
    This worked for me. Thanks! It's very important people... verify that you are using the Web Client (auto created by Google Service) Client ID... NOT the Android one.
     
    Rodolfo-Rubens likes this.
  25. vARDAmir88

    vARDAmir88

    Joined:
    Sep 9, 2015
    Posts:
    36
    THANKS A LOT! YOU SAVED MY DAY!
     
  26. az_ivan

    az_ivan

    Joined:
    Aug 25, 2012
    Posts:
    5
    I had the problem with callback not being called. After a full day I fixed with these steps:
    1. I had older version of the Play Games Plugin for Unity. I installed over it v11.01. So I had to manually delete all traces of the plugin from the project (Assets/Plugins/Android and Assets/Plugins/iOS). Then I re-installed v11.01.
    2. I made sure to have the Web Client OAuth Client ID from Google Console in the Client ID text box in Unity/Windows/Google Play Games/Setup/Android Setup. Maybe it would work without it.
    3. In the C# unity scripts I call first
    Code (CSharp):
    1. PlayGamesPlatform.Activate();
    Google's documentation explicitly is saying not to call it and this is a mistake! Call it! Then
    Code (CSharp):
    1.         Social.localUser.Authenticate((bool success) => {
    2.             if (success)
    3.             {
    4.                   ...
    5.             }
    6.             else
    7.             {
    8.                   ...
    9.             }
    10.         });
    Then such quick output would give you the actual online user data:
    Code (CSharp):
    1.         if (allowUserPrint)
    2.         {
    3.             GUI.DrawTexture(new Rect(10, 300, 50, 50), Social.localUser.image);
    4.             GUI.Label(new Rect(10, 360, 300, 50), Social.localUser.userName);
    5.             GUI.Label(new Rect(10, 400, 300, 50), Social.localUser.id);
    6.             GUI.Label(new Rect(10, 440, 300, 50), Social.localUser.state.ToString());
    7.  
    8.         }
    These should be enough to indicate that you are using the actual google play account data. Any logout/login popups can be considered as next steps in your Google Play Games Auth journey.
    4. If you try your Unity app in the Windows Unity Editor it will fail to initialize the Google Play Games plugin or call the Auth. Best it does is to provide you an offline dummy user. To try it for real I was using BlueStacks Android emulator for Windows. It has a quick way to upload the .apk generated by Unity. System Apps/Media Manager/Imported Files/Import from Windows. Also make sure you have a logged in google account in the BlueStacks.
    5. My android app is registered in the Google Play Console. Its SHA1 footprint registered in Google Play Console matches with the private key by which the .apk is signed in Unity. Still it is good that the auth parts work in Bluestacks without having to upload the .apk in Firebase or Google Play Console.
    6. Better feedback can be obtained by using this overload of the Authenticate method:

    Code (CSharp):
    1.     PlayGamesPlatform.Instance.Authenticate(null,
    2.     ProcessAuthentication3);
    3. ....
    4.     internal void ProcessAuthentication3(bool succ, string res)
    5.     {
    6.         if (succ)
    7.         {
    8.             state = "success " + res ?? "null";
    9.             Debug.Log("Success");
    10.         }
    11.         else
    12.         {
    13.             state = "unsuccess " + res ?? "null";
    14.             Debug.Log("Unsuccess");
    15.         }
    16.     }
    17.