playgameservices / play-games-plugin-for-unity

Google Play Games plugin for Unity
Other
3.44k stars 959 forks source link

How to detect user uninstalling Google Play Games after signing in #3043

Open FunnerSoft opened 3 years ago

FunnerSoft commented 3 years ago

Hello,

I am trying to detect the following situation:

This scenario causes errors for my app, and so I want to detect it happening.

I tried the following, none of it fails:

bool isInstalledAndSignedIn()
{
            if(PlayGamesPlatform.Instance == null)
                return(false);
            if(PlayGamesPlatform.Instance.localUser == null)
                return(false);
            if(!(PlayGamesPlatform.Instance.localUser.authenticated))
                return(false);
           return(true);
}

I found that if I end up doing another system type call (SignIn, SignOut, etc) in this scenario, then the user is prompted to re-install Google Play Games.

But, I obviously don't want to spam calls to those every tick just to try and catch this scenario.

Any help would be appreciated. Thank you