Search code examples
androidgame-maker

how do I disable google play auto login in game maker?


Am using google play services in my gamemaker studio game, I noticed that if a player isn't signed in to google play the game will keep asking for a sign in after showing interstitial ads or even when screen is locked and unlocked. I want the sign in popup to show only when user taps the right button. How do I stop the auto login popup? Thanks in advance


Solution

  • Try this: Go to 'YourGame.gmx > extensions > GooglePlayServicesExtension > AndroidSource > Java' where "YourGame.gmx" is your project file. Now open GooglePlayServicesExtension.java with Notepad or any other text editing software. Find this chunk of code:

    @Override
    public void onStart() 
    {
        Log.i("yoyo","googleplayservices extension onStart called");
        //super.onStart();
        if (mGoogleApiClient != null) 
            mGoogleApiClient.connect();
    }
    

    Now comment the if statement and the line of code inside it. So change it to this:

    @Override
    public void onStart() 
    {
        Log.i("yoyo","googleplayservices extension onStart called");
        //super.onStart();
        //if (mGoogleApiClient != null) 
            //mGoogleApiClient.connect();
    }
    

    Now save it (Ctrl + S). This disables auto login to Google Play Services at the start of your game or to be more precise whenever onStart() is called. Hope it helps for your situation.