gpt4 book ai didi

android - Google Play 游戏服务 - 欢迎 <名称> 弹出窗口不一致

转载 作者:行者123 更新时间:2023-12-03 17:52:05 26 4
gpt4 key购买 nike

我在其他线程中尝试了一些建议(例如在启动时强制注销),但我还没有找到解决这个问题的方法。问题在于这个弹出窗口:

Welcome <name> popup image

它似乎非常不一致,很少出现。

我添加了一个 GameHelper.logout()在我的应用程序中启动以尝试始终显示此消息,但事实并非如此。

通常情况下,它根本不会出现。

调用方法如getGameClient().getCurrentUser().getIconImageUri()一切正常,我可以以这种方式显示图像。此外,我可以发送邀请,人们会和我一起坐在游戏大厅里。

当他们点击游戏主屏幕上的 Google+ 登录按钮时,我是否可以始终如一地显示此消息?

需要注意的是,我使用的是 LibGDX,BaseGameUtils(GameHelper.java)Google Services (当然)。

还有其他人有这个问题吗?

谢谢!

最佳答案

好的,所以我将在这里发布我是如何设置的,使用 LibGDX 和 GPGS,并且在注销后登录时显示弹出窗口没有任何问题。

首先是我对我的 Android 项目的声明:

public class MainActivity extends AndroidApplication implements RequestHandler, GameHelperListener,
GoogleInterface, RealTimeMessageReceivedListener, RoomStatusUpdateListener, RoomUpdateListener,
OnInvitationReceivedListener, RealTimeReliableMessageSentListener, OnImageLoadedListener, OnStateLoadedListener, ConnectionCallbacks{
private GameHelper mHelper;
private GameHelperInterface mGHInterface = null;
private ConfirmInterface mConfirmInterface = null;
private Handler libGDXHandler;

GoogleInterface 用于从 LibGDX 线程传递到 Android 线程,GameHelperInterface 和 ConfirmInterface 用于将事物从 android 传递到房子的 libGDX 端(我使用 confirmInteface 来登录东西,另一个用于消息传递,等等......)处理程序是为了确保来自 LibGDX 端的任何内容都正确发布在 Android 线程上(就像来自 Android 的 libGDX 端的任何内容都使用 Gdx.app.postRunnable() 发布)

现在我在 onCreate() 中声明
.. setup the gameView etc..
mHelper.setup(this, GameHelper.CLIENT_GAMES | GameHelper.CLIENT_APPSTATE | GameHelper.CLIENT_PLUS, null);
mHelper.getPlusClient().registerConnectionCallbacks(this);

onStart 和 onStop :
@Override
public void onStart(){
super.onStart();
mHelper.onStart(this);
}

@Override
public void onStop(){
super.onStop();
mHelper.onStop();
}

Android 代码中的 Login 和 Logout 方法
@Override
public void Login() {
libGDXHandler.post(new Runnable() {

@Override
public void run() {
dLog("beginUserInitatedSignIn()");
//mHelper.signOut();
mHelper.beginUserInitiatedSignIn();

}
});

}

@Override
public void LogOut() {
iServerBadAttempts = -1;
mHelper.signOut();

}

使用 iServerBadAttempts 以便当我在 libGDX 中启动 Screen 进程时,我可以要求 Android 端给我该变量...如果它是 -1,那么我知道之前没有尝试过登录,并且可以设置我的谷歌登录按钮适当,否则我检查连接状态和其他几件事来设置我使用的按钮。

为了以防万一,下面是我告诉我的 libGDX 代码 mHelper 成功登录的方式:
@Override
public void onSignInSucceeded() {
dLog("signed in");
mConfirmInterface.googleSucceeded();
if (mHelper.getInvitationId() != null) {
acceptInviteToRoom(mHelper.getInvitationId());
mConfirmInterface.acceptedInvitation();

}


}

这是登录和注销的logcat

09-24 09:14:31.495: I/SplashScreen(6021): Doing Google Login 09-24 09:14:31.495: D/LDGame MainActivity(6021): beginUserInitatedSignIn() 09-24 09:14:31.495: D/Helper(6021): Starting USER-INITIATED sign-in flow. 09-24 09:14:31.495: D/Helper(6021): isGooglePlayServicesAvailable returned 0 09-24 09:14:31.495: D/Helper(6021): beginUserInitiatedSignIn: starting new sign-in flow. 09-24 09:14:31.495: D/Helper(6021): Starting connections. 09-24 09:14:31.495: D/Helper(6021): State change DISCONNECTED -> CONNECTING 09-24 09:14:31.495: D/Helper(6021): connectNextClient: requested clients: 7, connected clients: 0 09-24 09:14:31.495: D/Helper(6021): Pending clients: 7 09-24 09:14:31.495: D/Helper(6021): Connecting GamesClient. 09-24 09:14:31.535: D/Helper(6021): onConnectionFailed 09-24 09:14:31.535: D/Helper(6021): Connection failure: 09-24 09:14:31.535: D/Helper(6021): - code: SIGN_IN_REQUIRED(4) 09-24 09:14:31.535: D/Helper(6021): - resolvable: true 09-24 09:14:31.535: D/Helper(6021): - details: ConnectionResult{statusCode=SIGN_IN_REQUIRED, resolution=PendingIntent{41d914d0: android.os.BinderProxy@41ef40c8}} 09-24 09:14:31.535: D/Helper(6021): onConnectionFailed: since user initiated sign-in, resolving problem. 09-24 09:14:31.535: D/Helper(6021): resolveConnectionResult: trying to resolve result: ConnectionResult{statusCode=SIGN_IN_REQUIRED, resolution=PendingIntent{41d914d0: android.os.BinderProxy@41ef40c8}} 09-24 09:14:31.535: D/Helper(6021): Result has resolution. Starting it. 09-24 09:14:31.615: I/ScreenLog(6021): SCREEN PAUSE: SplashScreen 09-24 09:14:31.615: D/SensorManager(6021): unregisterListener:: Listener= com.badlogic.gdx.backends.android.AndroidInput$SensorListener@41dc06e0 09-24 09:14:31.615: I/AndroidGraphics(6021): paused 09-24 09:14:31.615: D/Sensors(6021): Remain listener = Sending .. normal delay 200ms 09-24 09:14:31.615: I/Sensors(6021): sendDelay --- 200000000 09-24 09:14:31.615: D/SensorManager(6021): JNI - sendDelay 09-24 09:14:31.615: I/SensorManager(6021): Set normal delay = true 09-24 09:14:31.615: D/SensorManager(6021): unregisterListener:: Listener= com.badlogic.gdx.backends.android.AndroidInput$SensorListener@41db99a0 09-24 09:14:31.615: D/Sensors(6021): Remain listener = Sending .. normal delay 200ms 09-24 09:14:31.615: I/Sensors(6021): sendDelay --- 200000000 09-24 09:14:31.620: D/SensorManager(6021): JNI - sendDelay 09-24 09:14:31.620: I/SensorManager(6021): Set normal delay = true 09-24 09:14:31.620: I/AndroidInput(6021): sensor listener tear down 09-24 09:14:32.220: W/IInputConnectionWrapper(6021): showStatusIcon on inactive InputConnection 09-24 09:14:37.010: D/Helper(6021): onActivityResult: req=RC_RESOLVE, resp=RESULT_OK 09-24 09:14:37.010: D/Helper(6021): onAR: Resolution was RESULT_OK, so connecting current client again. 09-24 09:14:37.065: D/LDGame MainActivity(6021): on Activity Result 09-24 09:14:37.065: D/SensorManager(6021): registerListener :: handle = 0 name= LSM330DLC 3-axis Accelerometer delay= 20000 Listener= com.badlogic.gdx.backends.android.AndroidInput$SensorListener@41ef6c38 09-24 09:14:37.070: D/SensorManager(6021): registerListener :: handle = 1 name= AK8975C 3-axis Magnetic field sensor delay= 20000 Listener= com.badlogic.gdx.backends.android.AndroidInput$SensorListener@41ef6f00 09-24 09:14:37.070: I/AndroidInput(6021): sensor listener setup 09-24 09:14:37.100: I/ScreenLog(6021): SCREEN RESIZE: SplashScreen 09-24 09:14:37.100: I/ScreenLog(6021): SCREEN RESUME: SplashScreen 09-24 09:14:37.160: D/dalvikvm(6021): GC_CONCURRENT freed 674K, 13% free 13233K/15047K, paused 7ms+3ms, total 61ms 09-24 09:14:37.160: D/dalvikvm(6021): WAIT_FOR_CONCURRENT_GC blocked 22ms 09-24 09:14:37.180: D/dalvikvm(6021): GC_FOR_ALLOC freed 10K, 13% free 13222K/15047K, paused 18ms, total 18ms 09-24 09:14:37.180: I/dalvikvm-heap(6021): Grow heap (frag case) to 13.932MB for 313374-byte allocation 09-24 09:14:37.200: D/dalvikvm(6021): GC_FOR_ALLOC freed <1K, 12% free 13528K/15367K, paused 19ms, total 19ms 09-24 09:14:37.235: D/SensorManager(6021): onAccuracyChanged :: accuracy = 3 09-24 09:14:37.240: D/Helper(6021): onConnected: connected! client=1 09-24 09:14:37.240: D/Helper(6021): Connected clients updated to: 1 09-24 09:14:37.240: D/Helper(6021): connectNextClient: requested clients: 7, connected clients: 1 09-24 09:14:37.240: D/Helper(6021): Pending clients: 6 09-24 09:14:37.240: D/Helper(6021): Connecting PlusClient. 09-24 09:14:37.395: D/dalvikvm(6021): GC_FOR_ALLOC freed 511K, 14% free 13236K/15367K, paused 20ms, total 20ms 09-24 09:14:37.570: D/dalvikvm(6021): GC_CONCURRENT freed 320K, 14% free 13319K/15367K, paused 1ms+1ms, total 34ms 09-24 09:14:37.755: D/dalvikvm(6021): GC_CONCURRENT freed 482K, 14% free 13295K/15367K, paused 12ms+2ms, total 33ms 09-24 09:14:37.840: I/AndroidGraphics(6021): resumed 09-24 09:14:38.055: D/Helper(6021): onConnected: connected! client=2 09-24 09:14:38.055: D/Helper(6021): Connected clients updated to: 3 09-24 09:14:38.055: D/Helper(6021): connectNextClient: requested clients: 7, connected clients: 3 09-24 09:14:38.055: D/Helper(6021): Pending clients: 4 09-24 09:14:38.055: D/Helper(6021): Connecting AppStateClient. 09-24 09:14:38.070: D/LDGame MainActivity(6021): inside on connected 09-24 09:14:38.070: D/LDGame MainActivity(6021): figures 09-24 09:14:38.090: D/Helper(6021): onConnected: connected! client=4 09-24 09:14:38.090: D/Helper(6021): Connected clients updated to: 7 09-24 09:14:38.090: D/Helper(6021): connectNextClient: requested clients: 7, connected clients: 7 09-24 09:14:38.090: D/Helper(6021): Pending clients: 0 09-24 09:14:38.090: D/Helper(6021): All clients now connected. Sign-in successful! 09-24 09:14:38.090: D/Helper(6021): All requested clients connected. Sign-in succeeded! 09-24 09:14:38.090: D/Helper(6021): State change CONNECTING -> CONNECTED 09-24 09:14:38.090: D/Helper(6021): Notifying LISTENER of sign-in SUCCESS 09-24 09:14:38.090: D/LDGame MainActivity(6021): signed in



对于登录,重点是您应该看到“D/Helper(6021):onConnectionFailed:因为用户启动登录,正在解决问题。”因为这意味着注销以前有效

并退出 logcat

09-24 09:14:52.145: D/Helper(6021): Clearing default account on PlusClient. 09-24 09:14:52.165: D/Helper(6021): Signing out from GamesClient. 09-24 09:14:52.190: D/Helper(6021): Proceeding with disconnection. 09-24 09:14:52.190: D/Helper(6021): killConnections: killing connections. 09-24 09:14:52.190: D/Helper(6021): Disconnecting GamesClient. 09-24 09:14:52.195: D/Helper(6021): Disconnecting PlusClient. 09-24 09:14:52.195: D/Helper(6021): Disconnecting AppStateClient. 09-24 09:14:52.195: D/Helper(6021): killConnections: all clients disconnected. 09-24 09:14:52.195: D/Helper(6021): State change CONNECTED -> DISCONNECTED



希望有帮助!

关于android - Google Play 游戏服务 - 欢迎 <名称> 弹出窗口不一致,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18950780/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com