简体   繁体   English

如何在游戏制作工具中禁用Google Play自动登录?

[英]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. 我在我的Gamemaker Studio游戏中使用Google Play服务时,我注意到,如果没有登录到Google Play的玩家,则游戏会在显示插页式广告后甚至在屏幕锁定和解锁时继续要求登录。 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 提前致谢

Try this: Go to 'YourGame.gmx > extensions > GooglePlayServicesExtension > AndroidSource > Java' where "YourGame.gmx" is your project file. 尝试以下操作:转到“ YourGame.gmx>扩展> GooglePlayServicesExtension> AndroidSource> Java”,其中“ YourGame.gmx”是您的项目文件。 Now open GooglePlayServicesExtension.java with Notepad or any other text editing software. 现在,使用记事本或任何其他文本编辑软件打开Goog​​lePlayServicesExtension.java。 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. 现在注释if语句和其中的代码行。 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). 现在保存它(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. 这会在游戏开始时禁用自动登录Google Play服务,或者在每次调用onStart()时更精确。 Hope it helps for your situation. 希望它对您的情况有所帮助。

The old ways of gm studio. gm studio的旧方法。

Go to gamemaker studio path >android>runner>src>yyandroidpackagedomain>yyandroidpackagecompany>yyandroidpackageproduct> and find gamehelper.java 转到Gamemaker Studio路径> android> runner> src> yyandroidpackagedomain> yyandroidpackagecompany> yyandroidpackageproduct>并找到gamehelper.java

Open in ms word and find these and change to this. 以ms字打开,找到这些并将其更改为。

boolean mConnectOnStart = false;
boolean mUserInitiatedSignIn = false;

public void setMaxAutoSignInAttempts(int max) {
    mMaxAutoSignInAttempts = 0;
}

Note not working on run test must compile first. 注意不能在运行测试中工作必须首先编译。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM