playgameservices / play-games-plugin-for-unity

Google Play Games plugin for Unity
Other
3.43k stars 954 forks source link

Google Play Games login popup appears twice #3100

Open ch4ron opened 2 years ago

ch4ron commented 2 years ago

After integrating Play Games plugin and enabling authentication, I can correctly see the "Hey there" login popup appearing on screen. However, the same popup will sometimes re-appear on screen while playing the game. I am calling the authentication methods only once and it seems that something is happening in the background. In the logs, I can see the following:

12-07 11:35:41.077: W/GetGamesServiceReqFacto(3982): Parsing request with ignored arguments. signInOptionsBundle [Bundle[mParcelledData.dataSize=1160]], isRetryingSignIn [false], skipWelcomePopup [false], requireGooglePlus [false]
12-07 11:35:41.290: I/Unity(31839): send start state to pg
12-07 11:35:41.810: I/SignInPerformer-0(3982): Handling request [GetGamesServiceRequest{gamePackageName=com.Company.App, gameUid=10119, gamePlayServicesClientLibraryVersion=12451000, sdkVariation=1052947, requestedScopes=[https://www.googleapis.com/auth/games_lite], callingIdentity=CallingIdentity{uid=10119, pid=31839, packageName=com.Company.App, playServicesClientLibraryVersion=12451000}, requestedAccount=Optional.absent(), forceResolveAccountKey=null, requestedServiceMode=0}], isFirstPartyCaller [false], Overdrive [disabled] [CONTEXT service_id=1 ]
12-07 11:35:41.907: W/GetGamesServiceReqFacto(3982): Parsing request with ignored arguments. signInOptionsBundle [Bundle[{com.google.android.gms.signin.internal.serverClientId=null, com.google.android.gms.signin.internal.usePromptModeForAuthCode=true, com.google.android.gms.signin.internal.logSessionId=null, com.google.android.gms.signin.internal.hostedDomain=null, com.google.android.gms.signin.internal.offlineAccessRequested=false, com.google.android.gms.signin.internal.waitForAccessTokenRefresh=false, com.google.android.gms.signin.internal.clientRequestedAccount=Account {name= XXXXXXXXX, type=com.google}, com.google.android.gms.signin.internal.idTokenRequested=false, com.google.android.gms.signin.internal.forceCodeForRefreshToken=false}]], isRetryingSignIn [false], skipWelcomePopup [false], requireGooglePlus [false]
12-07 11:35:41.911: I/SignInPerformer-0(3982): Found existing game run [GameRun(GameRunRecord{runId=2a346ad4-382c-4bde-ae07-d19c65a8917a, gameId=GameKey{packageName=com.Company.App}, account=Account {name= XXXXXXXXX, type=com.google}, capturedProcesses=[ProcessKey{processId=31839}, ProcessKey{processId=32461}], preOreoInstantGameUid=0})] [CONTEXT service_id=1 ]
12-07 11:35:41.990: I/SignInPerformer-1(3982): Handling request [GetGamesServiceRequest{gamePackageName=com.google.android.gms, gameUid=10019, gamePlayServicesClientLibraryVersion=214218000, sdkVariation=1052947, requestedScopes=[https://www.googleapis.com/auth/games_lite], callingIdentity=CallingIdentity{uid=10019, pid=3982, packageName=com.google.android.gms, playServicesClientLibraryVersion=214218000}, requestedAccount=Optional.absent(), forceResolveAccountKey=null, requestedServiceMode=2}], isFirstPartyCaller [true], Overdrive [disabled] [CONTEXT service_id=1 ]
12-07 11:35:41.997: I/SignInPerformer-1(3982): Successfully brokered first-party unauthenticated GamesService [CONTEXT service_id=1 ]
12-07 11:35:42.434: I/SignInPerformer-0(3982): Successfully resolved account: [<ELLIDED:718006122>] [CONTEXT service_id=1 ]
12-07 11:35:42.798: I/SignInPerformer-0(3982): Successfully authorized dti{clientPackageName=com.Company.App, clientUid=10119, account=<ELLIDED:718006122>, requestedScopes=[https://www.googleapis.com/auth/games_lite], shouldIncludeAllGrantedScopes=false, gamesAutoSignInPolicyAction=APPLY_AND_APPROVE, serverClientId=null, forceRefreshToken=false} [CONTEXT service_id=1 ]
12-07 11:35:42.878: I/PlayerManager(3982): Fetching player: account [<ELLIDED:718006122>] gamePackageName [com.Company.App] forceServerFetch [false] getLegacyPlayerIdResponse [GetLegacyPlayerIdResponse{wasSuccessful=true, legacyPlayerId=null}] [CONTEXT service_id=1 ]
12-07 11:35:42.981: I/PlayerManager(3982): Found player: account [<ELLIDED:718006122>] validatedLegacyPlayerId [false] playerId [playerId] legacyPlayerId [null] [CONTEXT service_id=1 ]
12-07 11:35:42.984: I/SignInPerformer-0(3982): Successfully found player (id [playerId], originalId [null], displayName [EerieWool35]) for account [<ELLIDED:718006122>] [CONTEXT service_id=1 ]
12-07 11:35:43.145: I/SignInPerformer-0(3982): Successfully found game: displayName [App], applicationId [493820630530], packageName [com.Company.App] [CONTEXT service_id=1 ]
12-07 11:35:43.155: I/SignInPerformer-0(3982): Game does not cloud save APIs. Skipping creation and connection to Internal Drive API. [CONTEXT service_id=1 ]
12-07 11:35:43.682: I/SignInManagerV2(3982): Recording sign-in successful: request[edx{gamePackageName=com.Company.App, gameUid=10119, account=<ELLIDED:718006122>, playerId=<ELLIDED:-187415219>, grantedScoped=[https://www.googleapis.com/auth/games_lite]}] [CONTEXT service_id=1 ]
ozdemir08 commented 2 years ago

Could you create a bug report and share it with us?

ozdemir08 commented 2 years ago

Also does your project have a custom activity or have several scenes that may be changing from one to other when the sign-in pop-up is still active?

ch4ron commented 2 years ago

Here's the bug report https://drive.google.com/file/d/1VgHvbDR0uz8K9HJyn5hb5ruYan3R6CFQ/view?usp=sharing A scene is loading during app initialization when the pop-up is active. Could that be an issue? I've also noticed that when the pop-up reappears it's usually after a scene transition (but that's not a rule, it can also show up when seemingly nothing is happening in the background).

ozdemir08 commented 2 years ago

Thanks for the bug report, I will be looking into this this week.

ozdemir08 commented 2 years ago

Here's the bug report https://drive.google.com/file/d/1VgHvbDR0uz8K9HJyn5hb5ruYan3R6CFQ/view?usp=sharing A scene is loading during app initialization when the pop-up is active. Could that be an issue? I've also noticed that when the pop-up reappears it's usually after a scene transition

From the bug report, it looks like there is one sign-in attempt and it is successful as expected. It is possible that the scene transition causes that. I will look into how Unity converts scenes into Android components. Unity has a default UnityPlayerActivity. But we should understand whether the apk has several of this activity when there are multiple scenes. It would be useful to us, if you could share the manifest file of your apk as well.

(but that's not a rule, it can also show up when seemingly nothing is happening in the background).

Is there a scene transition though, before or after this?

ch4ron commented 2 years ago

Here's my manifest file https://drive.google.com/file/d/1THU-sGiu5WLFheKJKYoRLaYPuO4NbhwR/view?usp=sharing

Is there a scene transition though, before or after this?

There are multiple scene transitions in the game but I have also seen the popup appearing not directly before or after this. I can see UnityPlayerActivity in Firebase Analytics but I don't know if it's related to the issue with the Play Games popup.

ch4ron commented 2 years ago

I did some further investigation and the popup appears when achievements are progressed. Hope that helps with resolving the issue.