question

Adam Galla avatar image
Adam Galla asked

Google Plus Access Token crash

Hi, I'm working on a game in unity where I want to use the playfab login with google play access id function. For getting the access id I try to use the solutions from the Unity3d_Login_Example. (https://github.com/PlayFab/Unity3d_Login_Example_Project/tree/master/Assets)

After selecting the account, and the plugin starts to get the token, the program crashes, and the log shows this error:

10-29 12:53:03.556 19877-19877/? E/dalvikvm: VM aborting
10-29 12:53:03.556 19877-19877/? A/libc: Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1), thread 19877 (ootgames.maz015)
10-29 12:53:03.572 20016-20016/? E/ActivityThread: Activity com.google.android.gms.common.account.SimpleAccountPickerActivity has leaked IntentReceiver com.immersion.android.haptics.HapticFeedbackManager$HapticFeedbackBroadcastReceiver@41bbd750 that was originally registered here. Are you missing a call to unregisterReceiver()?
10-29 12:53:03.572 20016-20016/? E/ActivityThread: android.app.IntentReceiverLeaked: Activity com.google.android.gms.common.account.SimpleAccountPickerActivity has leaked IntentReceiver com.immersion.android.haptics.HapticFeedbackManager$HapticFeedbackBroadcastReceiver@41bbd750 that was originally registered here. Are you missing a call to unregisterReceiver()?
10-29 12:53:03.572 20016-20016/? E/ActivityThread: at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:800)
10-29 12:53:03.572 20016-20016/? E/ActivityThread: at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:601)
10-29 12:53:03.572 20016-20016/? E/ActivityThread: at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1650)
10-29 12:53:03.572 20016-20016/? E/ActivityThread: at android.app.ContextImpl.registerReceiver(ContextImpl.java:1630)
10-29 12:53:03.572 20016-20016/? E/ActivityThread: at android.app.ContextImpl.registerReceiver(ContextImpl.java:1624)
10-29 12:53:03.572 20016-20016/? E/ActivityThread: at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:430)
10-29 12:53:03.572 20016-20016/? E/ActivityThread: at com.immersion.android.haptics.HapticFeedbackManager.setupPackageBroadcastReceiver(HapticFeedbackManager.java:564)
10-29 12:53:03.572 20016-20016/? E/ActivityThread: at com.immersion.android.haptics.HapticFeedbackManager.<init>(HapticFeedbackManager.java:108)
10-29 12:53:03.572 20016-20016/? E/ActivityThread: at com.immersion.android.HapticFeedbackManagerProxy.initialize(HapticFeedbackManagerProxy.java:90)
10-29 12:53:03.572 20016-20016/? E/ActivityThread: at com.immersion.android.HapticFeedbackManagerProxy.access$100(HapticFeedbackManagerProxy.java:30)
10-29 12:53:03.572 20016-20016/? E/ActivityThread: at com.immersion.android.HapticFeedbackManagerProxy$1$1.run(HapticFeedbackManagerProxy.java:71)
10-29 12:53:03.572 20016-20016/? E/ActivityThread: at java.lang.Thread.run(Thread.java:856)

Could you help me please?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Adam Galla avatar image
Adam Galla answered

Thank you for your advice and sorry for the long delay. I had other things to do, but now I focusing on this problem again. I made a simple script, and added the parts you mentioned to the manifest file.

At this point when I call the 'GooglePlusSignIn()' method, a window pop up with my added accounts. I select my google account, but then two message shows up:
"Internal Error Occurs" (not sure, if this is the right translation, since it shows up in hungarian, but the next message is in english)

"This application requires Google Account."

Here is my code:

public class TestScript : MonoBehaviour 
{
    public Text DEBUG;

    AndroidJavaClass activityClass;
    const int GET_TOKEN_REASON = 2;
    const int SIGN_IN_REASON = 1;

    void Start()
    {
        DEBUG.text = "Initalize...";

        AndroidJNI.AttachCurrentThread();
        string className = "com.ThugLeaf.GooglePlusForUnity.GooglePlusActivity";
        activityClass = new AndroidJavaClass(className);
        activityClass.SetStatic<string>("UnityObjectName", "MainMenuLogic"); 


        DEBUG.text += "\nInitalize finished.";
    }

    public void GooglePlusSignIn(){
        DEBUG.text += "\nSigning in.";

        activityClass.SetStatic<string>("OnTokenReceivedCallback", "OnSignInSuccess");
        activityClass.CallStatic("Start", new object[] { SIGN_IN_REASON });
    }

    public void OnSignInSuccess(string googleId) 
    {
        DEBUG.text += "\nSign in success ("+googleId+")";
        // use googleId
        GetToken();
    }

    public void GetToken()
    {
        DEBUG.text += "\nGet Token...";
        activityClass.SetStatic<string>("OnTokenReceivedCallback", "OnGoogleTokenReceived"); 
        activityClass.CallStatic("Start", new object[] { GET_TOKEN_REASON });
    }

    public void OnTokenReceivedCallback(string accessToken) 
    {
        DEBUG.text += "\nToken recieved: " + accessToken;
    } 
}

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hamza Lazaar avatar image
Hamza Lazaar answered

Hi again Adam,

You're almost there!

The famous undocumented "An Internal Error Occurred" toast message probably indicates a problem in the configuration in Google Dev. Console. Maybe you forgot to save "OAuth Consent screen" (you just need an email and app display name):

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Adam Galla avatar image
Adam Galla answered

Hmm. I got a project in the Developer console, and it's OAuth consent screen is filled. However I don't remember if I linked it to my app. I should set the client id somewhere in unity, right?

Could you tell me where or how?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hamza Lazaar avatar image
Hamza Lazaar answered

I think the version you have does not include a way of using Google OAuth scope using ClientID. I just created a github repo with last code I have here. I'm thinking about writing a blog post about this (it was an advice from Zach Bragg). I just need to find enough time. 

Unfortunately I can tell you from my own experience knowing which scope to use and which ClientID you should create is something that is not well documented. Anyway to add a ClientID you just have to copy paste it in the new version of the GooglePlusWrapper class that should work with the new version of the plugin only. I cannot guarantee anything, I'm still testing this myself whenever I have time but to sum up, I'm not completely sure how scopes should be constructed and which ClientID I should create from the Google Dev. Console (always trying Android one). Don't forget to sign the apk and use the SHA1 key from the keystore to create the ClientID.

here is the part I'm still investigating:

private String getToken(String accountName) {
   
  String code = null;
  try {
  String scopes = "oauth2:";
  if (ClientId == "" || ClientId == null || ClientId.isEmpty()){
  scopes += Scopes.PLUS_LOGIN;
  code = GoogleAuthUtil.getToken(this, // Context context
  accountName, // String accountName
  scopes // String scope
  );
  Log.i(TAG, scopes);
  }else {
  //scopes += "server:client_id:" + ClientId + ":api_scope:" + Scopes.PLUS_LOGIN;
  scopes = "audience:server:client_id:" + ClientId; // Not the app's client ID.
  Log.i(TAG, scopes);
  Bundle appActivities = new Bundle();
  appActivities.putString(GoogleAuthUtil.KEY_REQUEST_VISIBLE_ACTIVITIES,
  "http://schemas.google.com/AddActivity http://schemas.google.com/BuyActivity");
  code = GoogleAuthUtil.getToken(this, // Context context
  accountName, // String accountName
  scopes, // String scope
  appActivities
  );
  }
   
  } catch (GooglePlayServicesAvailabilityException playEx) {
  showErrorDialog(playEx.getConnectionStatusCode());
  Log.e(TAG,
  "GooglePlayServicesAvailabilityException : "
  + playEx.getMessage(), playEx);
  } catch (IOException transientEx) {
  // network or server error, the call is expected to succeed if you
  // try again later.
  // Don't attempt to call again immediately - the request is likely
  // to
  // fail, you'll hit quotas or back-off.
  Log.e(TAG,
  "transient error encountered : " + transientEx.getMessage(),
  transientEx);
  doExponentialBackoff();
  // return;
  } catch (UserRecoverableAuthException e) {
  // Requesting an authorization code will always throw
  // UserRecoverableAuthException on the first call to
  // GoogleAuthUtil.getToken
  // because the user must consent to offline access to their data.
  // After
  // consent is granted control is returned to your activity in
  // onActivityResult
  // and the second call to GoogleAuthUtil.getToken will succeed.
   
  startActivityForResult(e.getIntent(), REQUEST_CODE_AUTH_CONSENT);
  // return;
  } catch (GoogleAuthException authEx) {
  // Failure. The call is not expected to ever succeed so it should
  // not be
  // retried.
  Log.w(TAG,
  "Unrecoverable authentication exception : "
  + authEx.getMessage(), authEx);
   
  // return;
  } catch (Exception e) {
  Log.w(TAG, "Unhandled exception : " + e.getMessage(), e);
  }
  return code;
  }

 

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

andrestallos avatar image
andrestallos answered

Hi @Hamza Lazaar, I hope you don’t mind me reopening this old post, as I’ve come across the same problem discussed here. I’ve implemented Google Sign-In using your plugin (essentially copying and adapting the code from here) and when trying to sign-in for the first time, it shows the account picker fine, but then once you choose an account the game crashes when the additional popup comes up asking for permissions (it asks for age range & language, and for basic profile info). After the app crashes, I can still allow those permissions, and if I do that I can later sign-in and sign-out with that account without problem in the game. Trying to sign-in or out with an account that still hasn't granted permission causes the crash again, so the problem seems to be specifically caused by the permissions popup. I copy the error trace below.

I have tried using the workaround, calling Sign-in before GetToken, but I then get a different crash. I copy the trace further below. It says that it’s calling a class when it’s expecting an interface, which on a quick search seems to be caused by having libraries compiled with an old version of gms which is no longer compatible with the one we’re using. Is there any chance you could share an updated version of the libraries Thank you!

11-11 20:42:50.026 4973 18235 I ActivityManager: START u0 {cmp=com.Everguild.DrakenlordsBeta/com.ThugLeaf.GooglePlusForUnity.GooglePlusActivity} from uid 10180 on display 0

11-11 20:42:50.043 18044 18061 I GooglePlusActivity: StartingActivity 2

11-11 20:42:50.116 18044 18061 I Unity : SwitchToOfflineMode = True

11-11 20:42:50.116 18044 18061 I Unity :

11-11 20:42:50.116 18044 18061 I Unity : (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

11-11 20:42:50.116 18044 18061 I Unity :

11-11 20:42:50.130 4973 13387 I MediaFocusControl: AudioFocus abandonAudioFocus() from uid/pid 10180/18044 clientId=android.media.AudioManager@84310e2<native proxy object>

11-11 20:42:50.132 4973 7893 I sensors : activate

11-11 20:42:50.134 4973 7893 I nanohub : queueActivate: sensor=1, handle=1, enable=0

11-11 20:42:50.232 18044 18044 I GooglePlusActivity: onCreate 2

11-11 20:42:50.241 18044 18044 I GooglePlusActivity: onStart 2

11-11 20:42:50.242 4973 7007 I ActivityManager: START u0 {act=com.google.android.gms.common.account.CHOOSE_ACCOUNT pkg=com.google.android.gms cmp=com.google.android.gms/.common.account.SimpleAccountPickerActivity (has extras)} from uid 10180 on display 0

11-11 20:42:50.276 18044 18044 I GooglePlusActivity: onResume 2

11-11 20:42:50.307 4973 15090 I ActivityManager: Start proc 18256:com.google.android.gms.ui/u0a13 for activity com.google.android.gms/.common.account.SimpleAccountPickerActivity

11-11 20:42:50.550 18256 18256 W linker : /data/app/com.google.android.gms-2/lib/arm64/libgmscore.so: unused DT entry: type 0x7ffffffd arg 0x885

11-11 20:42:50.556 18256 18256 W linker : /data/app/com.google.android.gms-2/lib/arm64/libconscrypt_gmscore_jni.so: unused DT entry: type 0x7ffffffd arg 0x169

11-11 20:42:50.556 18256 18256 V JNIHelp : Registering com/google/android/gms/org/conscrypt/NativeCrypto's 235 native methods...

11-11 20:42:50.600 18256 18256 D NetworkSecurityConfig: No Network Security Config specified, using platform default

11-11 20:42:50.611 18256 18256 I ProviderInstaller: Installed default security provider GmsCore_OpenSSL

11-11 20:42:50.661 18256 18267 W art : Suspending all threads took: 7.858ms

11-11 20:42:50.666 18256 18267 I art : Background sticky concurrent mark sweep GC freed 18500(1177KB) AllocSpace objects, 2(40KB) LOS objects, 33% free, 4MB/6MB, paused 8.281ms total 25.058ms

11-11 20:42:50.699 18256 18256 D ChimeraActivityProxy: Loading activity implementation for ComponentInfo{com.google.android.gms/com.google.android.gms.common.account.SimpleAccountPickerActivity}

11-11 20:42:50.751 18256 18256 D ChimeraActivityProxy: Proxying container activity ComponentInfo{com.google.android.gms/com.google.android.gms.common.account.SimpleAccountPickerActivity} to Chimera activity impl .common.account.SimpleAccountPickerChimeraActivity

11-11 20:42:51.295 18256 18275 I Adreno : QUALCOMM build : 74df444, I409c65498b

11-11 20:42:51.295 18256 18275 I Adreno : Build Date : 06/22/16

11-11 20:42:51.295 18256 18275 I Adreno : OpenGL ES Shader Compiler Version: XE031.08.00.02

11-11 20:42:51.295 18256 18275 I Adreno : Local Branch : N16

11-11 20:42:51.295 18256 18275 I Adreno : Remote Branch :

11-11 20:42:51.295 18256 18275 I Adreno : Remote Branch :

11-11 20:42:51.295 18256 18275 I Adreno : Reconstruct Branch :

11-11 20:42:51.327 18256 18275 I OpenGLRenderer: Initialized EGL, version 1.4

11-11 20:42:51.328 18256 18275 D OpenGLRenderer: Swap behavior 1

11-11 20:42:51.610 4973 4993 I ActivityManager: Displayed com.google.android.gms/.common.account.SimpleAccountPickerActivity: +1s325ms (total +1s474ms)

11-11 20:43:02.926 18044 18044 I GooglePlusActivity: onActivityResult reqCode=1002 resCode=-1

11-11 20:43:02.936 18256 18275 D OpenGLRenderer: endAllActiveAnimators on 0x7760f4b000 (RippleDrawable) with handle 0x776d91b9e0

11-11 20:43:02.942 18044 18044 I GooglePlusActivity: onResume 2

11-11 20:43:03.072 4973 6754 I ActivityManager: Process com.android.musicfx (pid 17787) has died

11-11 20:43:03.072 4973 6754 D ActivityManager: cleanUpApplicationRecord -- 17787

11-11 20:43:03.097 4973 4993 I WindowManager: Destroying surface Surface(name=com.google.android.gms/com.google.android.gms.common.account.SimpleAccountPickerActivity) called by com.android.server.wm.WindowStateAnimator.destroySurface:2014 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:881 com.android.server.wm.WindowState.destroyOrSaveSurface:2073 com.android.server.wm.AppWindowToken.destroySurfaces:363 com.android.server.wm.WindowStateAnimator.finishExit:565 com.android.server.wm.WindowStateAnimator.stepAnimationLocked:491 com.android.server.wm.WindowAnimator.updateWindowsLocked:303 com.android.server.wm.WindowAnimator.animateLocked:704

11-11 20:43:03.115 399 399 W SurfaceFlinger: couldn't log to binary event log: overflow.

11-11 20:43:03.264 10390 28966 W Conscrypt: Could not set socket write timeout: null

11-11 20:43:03.412 10390 28966 W Conscrypt: Could not set socket write timeout: null

11-11 20:43:04.000 18044 18295 W Auth : [GoogleAuthUtil] GoogleAuthUtil

11-11 20:43:04.007 4973 13386 I ActivityManager: START u0 {act=com.google.android.gms.ui.UNPACKING_REDIRECT dat=intent://com.google.android.gms.auth.uiflows.common/69d6a63e-3fb8-4a5f-b0b9-5220c88f2d27 pkg=com.google.android.gms cmp=com.google.android.gms/.auth.uiflows.common.UnpackingRedirectActivity (has extras)} from uid 10180 on display 0

11-11 20:43:04.038 18256 18256 D ChimeraActivityProxy: Loading activity implementation for ComponentInfo{com.google.android.gms/com.google.android.gms.auth.uiflows.common.UnpackingRedirectActivity}

11-11 20:43:04.039 18256 18256 D ChimeraActivityProxy: Proxying container activity ComponentInfo{com.google.android.gms/com.google.android.gms.auth.uiflows.common.UnpackingRedirectActivity} to Chimera activity impl .auth.uiflows.common.UnpackingRedirectChimeraActivity

11-11 20:43:04.041 18044 18044 F libc : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 18044 (DrakenlordsBeta)

11-11 20:43:04.045 362 362 W : debuggerd: handling request: pid=18044 uid=10180 gid=10180 tid=18044

11-11 20:43:04.064 4973 29870 I ActivityManager: START u0 {cat=[categoryhack:7228819369473379633] flg=0x2000000 cmp=com.google.android.gms/.auth.uiflows.common.FilteringRedirectActivity (has extras)} from uid 10013 on display 0

11-11 20:43:04.106 18256 18256 D ChimeraActivityProxy: Loading activity implementation for ComponentInfo{com.google.android.gms/com.google.android.gms.auth.uiflows.common.FilteringRedirectActivity}

11-11 20:43:04.107 18256 18256 D ChimeraActivityProxy: Proxying container activity ComponentInfo{com.google.android.gms/com.google.android.gms.auth.uiflows.common.FilteringRedirectActivity} to Chimera activity impl .auth.uiflows.common.FilteringRedirectChimeraActivity

11-11 20:43:04.128 4973 15090 I ActivityManager: START u0 {cat=[categoryhack:69fd3ba2-2ac3-4d28-9da2-b00a2dd8cb05] cmp=com.google.android.gms/.auth.uiflows.controller.ControllerLauncherActivity (has extras)} from uid 10013 on display 0

11-11 20:43:04.175 18256 18256 D ChimeraActivityProxy: Loading activity implementation for ComponentInfo{com.google.android.gms/com.google.android.gms.auth.uiflows.controller.ControllerLauncherActivity}

11-11 20:43:04.176 18256 18256 D ChimeraActivityProxy: Proxying container activity ComponentInfo{com.google.android.gms/com.google.android.gms.auth.uiflows.controller.ControllerLauncherActivity} to Chimera activity impl .auth.uiflows.controller.ControllerLauncherChimeraActivity

11-11 20:43:04.196 4973 28421 I ActivityManager: Process com.google.android.apps.photos (pid 17004) has died

11-11 20:43:04.196 4973 28421 D ActivityManager: cleanUpApplicationRecord -- 17004

11-11 20:43:04.208 25926 25926 I MemoryTrimmer: Trimming objects from memory, since app is in the background.

11-11 20:43:04.221 4973 32058 I ActivityManager: Process com.google.android.apps.magazines (pid 17974) has died

11-11 20:43:04.222 4973 32058 D ActivityManager: cleanUpApplicationRecord -- 17974

11-11 20:43:04.248 16573 16573 I Finsky : [1] com.google.android.finsky.utils.dk.onTrimMemory(17): Memory trim requested to level 5

11-11 20:43:04.291 18299 18299 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***

11-11 20:43:04.291 18299 18299 F DEBUG : Build fingerprint: 'google/bullhead/bullhead:7.0/NBD90W/3239497:user/release-keys'

11-11 20:43:04.291 18299 18299 F DEBUG : Revision: 'rev_1.0'

11-11 20:43:04.291 18299 18299 F DEBUG : ABI: 'arm'

11-11 20:43:04.292 18299 18299 F DEBUG : pid: 18044, tid: 18044, name: DrakenlordsBeta >>> com.Everguild.DrakenlordsBeta <<<

11-11 20:43:04.292 18299 18299 F DEBUG : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0

11-11 20:43:04.304 18299 18299 F DEBUG : Abort message: 'SANDBOX: Adjust is running in Sandbox mode. Use this setting for testing. Don't forget to set the environment to `production` before publishing!'

11-11 20:43:04.304 18299 18299 F DEBUG : r0 00000000 r1 00000000 r2 00000000 r3 00000000

11-11 20:43:04.304 18299 18299 F DEBUG : r4 ed323230 r5 e61f3fd8 r6 00000000 r7 d318a430

11-11 20:43:04.304 18299 18299 F DEBUG : r8 cbeee478 r9 ffd4e294 sl ffd4e290 fp e61f3fd8

11-11 20:43:04.304 18299 18299 F DEBUG : ip d3129ad4 sp ffd4e1e8 lr d26cf618 pc ed6a1ad4 cpsr 600e0030

11-11 20:43:04.317 18299 18299 F DEBUG :

11-11 20:43:04.317 18299 18299 F DEBUG : backtrace:

11-11 20:43:04.318 18299 18299 F DEBUG : #00 pc 00018ad4 /system/lib/libc.so (strlen+71)

11-11 20:43:04.318 18299 18299 F DEBUG : #01 pc 004ff614 /data/app/com.Everguild.DrakenlordsBeta-2/lib/arm/libunity.so (UnitySendMessage+24)

11-11 20:43:04.318 18299 18299 F DEBUG : #02 pc 00511810 /data/app/com.Everguild.DrakenlordsBeta-2/lib/arm/libunity.so

11-11 20:43:04.318 18299 18299 F DEBUG : #03 pc 005ed7ed /data/app/com.Everguild.DrakenlordsBeta-2/oat/arm/base.odex (offset 0x590000)

11-11 20:43:04.430 4973 29870 I ActivityManager: START u0 {flg=0x2000000 cmp=com.google.android.gms/.auth.uiflows.gettoken.GetTokenActivity (has extras)} from uid 10013 on display 0

11-11 20:43:04.453 18256 18256 D ChimeraActivityProxy: Loading activity implementation for ComponentInfo{com.google.android.gms/com.google.android.gms.auth.uiflows.gettoken.GetTokenActivity}

11-11 20:43:04.454 18256 18256 D ChimeraActivityProxy: Proxying container activity ComponentInfo{com.google.android.gms/com.google.android.gms.auth.uiflows.gettoken.GetTokenActivity} to Chimera activity impl .auth.uiflows.gettoken.GetTokenChimeraActivity

11-11 20:43:04.708 4973 4985 I GnssLocationProvider: WakeLock acquired by handleInjectNtpTime()

11-11 20:43:04.718 4973 18303 I GnssLocationProvider: WakeLock acquired by sendMessage(10, 0, null)

11-11 20:43:04.718 4973 18303 I GnssLocationProvider: WakeLock released by handleInjectNtpTime()

11-11 20:43:04.719 4973 4985 I GnssLocationProvider: WakeLock released by handleMessage(10, 0, null)

11-11 20:43:04.739 4973 4993 I ActivityManager: Displayed com.google.android.gms/.auth.uiflows.gettoken.GetTokenActivity: +292ms (total +722ms)

11-11 20:43:05.021 4973 32059 I ActivityManager: START u0 {flg=0x2000000 cmp=com.google.android.gms/.auth.uiflows.consent.GrantCredentialsWithAclActivity (has extras)} from uid 10013 on display 0

===============================================================================================================================

This is the error trace when trying to use the SIGN_IN call before GET_TOKEN:

11-11 21:13:02.348 20919 20919 I GooglePlusActivity: onCreate 1

11-11 21:13:02.354 20919 20919 I GooglePlusActivity: onStart 1

11-11 21:13:02.354 20919 20919 I GooglePlusActivity: GooglePlusSignIn

11-11 21:13:02.363 20919 20919 D AndroidRuntime: Shutting down VM

11-11 21:13:02.389 20919 20919 E AndroidRuntime: FATAL EXCEPTION: main

11-11 21:13:02.389 20919 20919 E AndroidRuntime: Process: com.Everguild.DrakenlordsBeta, PID: 20919

11-11 21:13:02.389 20919 20919 E AndroidRuntime: java.lang.Error: FATAL EXCEPTION [main]

11-11 21:13:02.389 20919 20919 E AndroidRuntime: Unity version : 5.4.1p2

11-11 21:13:02.389 20919 20919 E AndroidRuntime: Device model : LGE Nexus 5X

11-11 21:13:02.389 20919 20919 E AndroidRuntime: Device fingerprint: google/bullhead/bullhead:7.0/NBD90W/3239497:user/release-keys

11-11 21:13:02.389 20919 20919 E AndroidRuntime:

11-11 21:13:02.389 20919 20919 E AndroidRuntime: Caused by: java.lang.IncompatibleClassChangeError: Found class com.google.android.gms.common.api.GoogleApiClient, but interface was expected (declaration of 'com.google.android.gms.common.api.GoogleApiClient' appears in /data/app/com.Everguild.DrakenlordsBeta-2/base.apk)

11-11 21:13:02.389 20919 20919 E AndroidRuntime: at com.ThugLeaf.GooglePlusForUnity.GooglePlusActivity.connect(GooglePlusActivity.java:462)

11-11 21:13:02.389 20919 20919 E AndroidRuntime: at com.ThugLeaf.GooglePlusForUnity.GooglePlusActivity.startResolution(GooglePlusActivity.java:579)

11-11 21:13:02.389 20919 20919 E AndroidRuntime: at com.ThugLeaf.GooglePlusForUnity.GooglePlusActivity.SignIn(GooglePlusActivity.java:386)

11-11 21:13:02.389 20919 20919 E AndroidRuntime: at com.ThugLeaf.GooglePlusForUnity.GooglePlusActivity.onStart(GooglePlusActivity.java:148)

11-11 21:13:02.389 20919 20919 E AndroidRuntime: at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1248)

11-11 21:13:02.389 20919 20919 E AndroidRuntime: at android.app.Activity.performStart(Activity.java:6681)

11-11 21:13:02.389 20919 20919 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2609)

11-11 21:13:02.389 20919 20919 E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)

11-11 21:13:02.389 20919 20919 E AndroidRuntime: at android.app.ActivityThread.-wrap12(ActivityThread.java)

11-11 21:13:02.389 20919 20919 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)

11-11 21:13:02.389 20919 20919 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)

11-11 21:13:02.389 20919 20919 E AndroidRuntime: at android.os.Looper.loop(Looper.java:154)

11-11 21:13:02.389 20919 20919 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6077)

11-11 21:13:02.389 20919 20919 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)

11-11 21:13:02.389 20919 20919 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)

11-11 21:13:02.389 20919 20919 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)

11-11 21:13:02.394 4973 10879 W ActivityManager: Force finishing activity com.Everguild.DrakenlordsBeta/com.ThugLeaf.GooglePlusForUnity.GooglePlusActivity

11-11 21:13:02.397 4973 10879 W ActivityManager: Force finishing activity com.Everguild.DrakenlordsBeta/com.unity3d.player.UnityPlayerNativeActivity

11-11 21:13:02.423 6228 6228 I MemoryTrimmer: Trimming objects from memory, since app is in the background.

11-11 21:13:02.473 4973 6731 I OpenGLRenderer: Initialized EGL, version 1.4

11-11 21:13:02.473 4973 6731 D OpenGLRenderer: Swap behavior 1

11-11 21:13:02.898 4973 4986 W ActivityManager: Activity pause timeout for ActivityRecord{9763c3a u0 com.Everguild.DrakenlordsBeta/com.ThugLeaf.GooglePlusForUnity.GooglePlusActivity t1350 f}

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

andrestallos avatar image
andrestallos answered

OK, I managed to get the workaround method to work (calling first SIGN_IN_REASON, the GET_TOKEN_REASON), by replacing the library in the login example project with the one in you shared in this other post.

It all works well now for sign-in purposes, though we still have one problem remaining: the LoginWithGoogleAccount call no longer saves the player's email information. We were able to get that information when using the other library and without the workaround (when it didn't crash, that is). Is there some way we can get that information? Thank you!

4 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hamza Lazaar avatar image Hamza Lazaar commented ·

Hi @andrestallos

I apologize for not noticing your comments earlier.

The whole thing about Google sign in and PlayFab and Unity and Android plugin is a puzzle.

Google has a new (better) sign in API now and PlayFab are updating their OAuth integration to support the new v3 tokens.

The new Google sign in API still has one issue I could not solve: sign out! I had to go through a workaround to try to make it work.

I've did few tests to try if PlayFab's support for new Google tokens is working and they did not succeed. Maybe I still need to play with scope/permissions.

What you're asking is maybe related to a change on PlayFab's side. @Brendan can confirm this. I've noticed this myself: the data displayed for linked Google account for players has changed: it's better displayed now with ability to unlink directly from GameManager, however what's being displayed differs from one account to another. One account shows Google ID only and for other accounts it shows the email and the "Google name" as well. Previously we had the "Locale", "Profile picture URL" and other data.

From the plugin you can still get the email after signing in.

0 Likes 0 ·
brendan avatar image brendan Hamza Lazaar commented ·

What's displayed is going to depend upon when and how the user account was set up, and what we have permission to read from it. Currently, when an account is created via LoginWithGoogleAccount, we attempt to get the following from Google: email address, name, picture URL, locale, gender, and profile URL.

0 Likes 0 ·
andrestallos avatar image andrestallos Hamza Lazaar commented ·

Hi @Hamza Lazaar, thank you for looking into it! One question based on your comments: how could we get the email from the plugin? In GooglePlusWrapper.cs I can see calls for getting displayName, profilePicture and circles, but not for getting the email.

And another question that we're struggling with, in case you've come across this by any chance. We have two versions of our game, beta and live, with separate projects in Google Play and in Playfab. With the same code, when using Google Sign-in (with the workaround and library mentioned earlier), in the beta version we get the account picker, as expected and desired, but in the live version we don't get the account picker. Instead it automatically picks the main account in the device, and I can't find a way to choose a different one. Do you have any idea as to what might be the reason? It's the same code and library, and this happens before involving Playfab, so I guess it must be related to either the project setup in Google Play or the device configuration, but I'm unable to figure it out.

Thank you!

0 Likes 0 ·
Hamza Lazaar avatar image Hamza Lazaar andrestallos commented ·

- I'm lost between different versions of the plugin I give online. I made a big mistake of not spending enough time and energy to make a github repository and a blogpost about this.

- The plugin should have a getEmail or getAccount method.

- Not seeing the account picker probably means there is a single account on the devide maybe I'm wrong. In the old plugin I was explicitly showing the account picker, in the new plugin it is shown automatically by the Google sign in call if multiple accounts are detected on the device.

Let me know if you still have issues, I hope I can find time to do this now (prepare the repo maybe with a simple demo on Unity).

0 Likes 0 ·
Hamza Lazaar avatar image
Hamza Lazaar answered

a new plugin is available here which should help PlayFab users get Google token v2 and v3 (should not crash) and takes care of account picker permission for Android 6.0 when requesting v2 tokens.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

andrestallos avatar image andrestallos commented ·

Thank you very much! I'll give it a try and let you know if we come across any issue.

1 Like 1 ·
marcowilliamspf avatar image
marcowilliamspf answered
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.