Google Play游戏服务 - 欢迎使用<name> Popup Inconsistent </name>

时间:2013-09-23 01:59:32

标签: android libgdx google-play-games

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

Welcome <name> popup image

看起来很不一致,很少出现。

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

通常情况下,它根本不会显示出来。

调用诸如getGameClient().getCurrentUser().getIconImageUri()之类的方法都能正常工作,我可以用这种方式显示图像。另外,我可以发送邀请,人们将和我一起坐在游戏大厅。

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

应该注意的是,我正在使用LibGDX,BaseGameUtils(GameHelper.java)Google Services(当然)。

还有其他人有此问题吗?

谢谢!

1 个答案:

答案 0 :(得分:0)

好的,所以我将在这里发布我如何设置,使用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()发布一样)< / p>

现在我在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中启动我的屏幕进程时,我可以让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):进行Google登录   09-24 09:14:31.495:D / LDGame MainActivity(6021):beginUserInitatedSignIn()   09-24 09:14:31.495:D / Helper(6021):启动USER-INITIATED登录流程。   09-24 09:14:31.495:D / Helper(6021):isGooglePlayServicesAvailable返回0   09-24 09:14:31.495:D / Helper(6021):beginUserInitiatedSignIn:开始新的登录流程。   09-24 09:14:31.495:D / Helper(6021):开始连接。   09-24 09:14:31.495:D / Helper(6021):状态变化已断开连接 - &gt; CONNECTING   09-24 09:14:31.495:D / Helper(6021):connectNextClient:请求的客户端:7,连接的客户端:0   09-24 09:14:31.495:D / Helper(6021):待定客户:7   09-24 09:14:31.495:D / Helper(6021):连接GamesClient。   09-24 09:14:31.535:D / Helper(6021):onConnectionFailed   09-24 09:14:31.535:D / Helper(6021):连接失败:   09-24 09:14:31.535:D / Helper(6021): - 代码:SIGN_IN_REQUIRED(4)   09-24 09:14:31.535:D / Helper(6021): - resolvable:true   09-24 09:14:31.535:D / Helper(6021): - 详情:ConnectionResult {statusCode = SIGN_IN_REQUIRED,resolution = PendingIntent {41d914d0:android.os.BinderProxy@41ef40c8}}   09-24 09:14:31.535:D / Helper(6021):onConnectionFailed:自用户启动登录,解决问题。   09-24 09:14:31.535:D / Helper(6021):resolveConnectionResult:尝试解析结果:ConnectionResult {statusCode = SIGN_IN_REQUIRED,resolution = PendingIntent {41d914d0:android.os.BinderProxy@41ef40c8}}   09-24 09:14:31.535:D / Helper(6021):结果有分辨率。开始吧   09-24 09:14:31.615:I / ScreenLog(6021):屏幕暂停: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):暂停   09-24 09:14:31.615:D / Sensors(6021):保持监听器=发送..正常延迟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):设置正常延迟=真   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):保持监听器=发送..正常延迟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):设置正常延迟=真   09-24 09:14:31.620:I / AndroidInput(6021):传感器监听器拆除   09-24 09:14:32.220:W / IInputConnectionWrapper(6021):showStatusIcon在非活动的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:分辨率为RESULT_OK,因此再次连接当前客户端。   09-24 09:14:37.065:D / LDGame MainActivity(6021):关于活动结果   09-24 09:14:37.065:D / SensorManager(6021):registerListener :: handle = 0 name = LSM330DLC 3轴加速度计延迟= 20000监听器= com.badlogic.gdx.backends.android.AndroidInput$SensorListener@41ef6c38   09-24 09:14:37.070:D / SensorManager(6021):registerListener :: handle = 1 name = AK8975C 3轴磁场传感器延迟= 20000 Listener = com.badlogic.gdx.backends.android.AndroidInput $ SensorListener @ 41ef6f00   09-24 09:14:37.070:I / AndroidInput(6021):传感器监听器设置   09-24 09:14:37.100:I / ScreenLog(6021):屏幕调整大小:SplashScreen   09-24 09:14:37.100:I / ScreenLog(6021):屏幕恢复:SplashScreen   09-24 09:14:37.160:D / dalvikvm(6021):GC_CONCURRENT释放674K,13%免费13233K / 15047K,暂停7ms + 3ms,总计61ms   09-24 09:14:37.160:D / dalvikvm(6021):WAIT_FOR_CONCURRENT_GC阻塞了22ms   09-24 09:14:37.180:D / dalvikvm(6021):GC_FOR_ALLOC释放10K,13%免费13222K / 15047K,暂停18ms,总计18ms   09-24 09:14:37.180:I / dalvikvm-heap(6021):将堆(frag case)增长到13.932MB,用于313374字节分配   09-24 09:14:37.200:D / dalvikvm(6021):GC_FOR_ALLOC释放<1K,12%自由13528K / 15367K,暂停19ms,总计19ms   09-24 09:14:37.235:D / SensorManager(6021):onAccuracyChanged :: accuracy = 3   09-24 09:14:37.240:D / Helper(6021):onConnected:已连接!客户= 1   09-24 09:14:37.240:D / Helper(6021):已连接的客户端更新为:1   09-24 09:14:37.240:D / Helper(6021):connectNextClient:请求的客户端:7,连接的客户端:1   09-24 09:14:37.240:D / Helper(6021):待定客户:6   09-24 09:14:37.240:D / Helper(6021):连接PlusClient。   09-24 09:14:37.395:D / dalvikvm(6021):GC_FOR_ALLOC释放511K,14%免费13236K / 15367K,暂停20ms,总计20ms   09-24 09:14:37.570:D / dalvikvm(6021):GC_CONCURRENT释放320K,14%免费13319K / 15367K,暂停1ms + 1ms,总计34ms   09-24 09:14:37.755:D / dalvikvm(6021):GC_CONCURRENT释放482K,14%免费13295K / 15367K,暂停12ms + 2ms,总计33ms   09-24 09:14:37.840:I / AndroidGraphics(6021):恢复了   09-24 09:14:38.055:D / Helper(6021):onConnected:已连接!客户= 2   09-24 09:14:38.055:D / Helper(6021):已连接的客户更新为:3   09-24 09:14:38.055:D / Helper(6021):connectNextClient:请求的客户端:7,连接客户端:3   09-24 09:14:38.055:D / Helper(6021):待定客户:4   09-24 09:14:38.055:D / Helper(6021):连接AppStateClient。   09-24 09:14:38.070:D / LDGame MainActivity(6021):连接内部   09-24 09:14:38.070:D / LDGame MainActivity(6021):数字   09-24 09:14:38.090:D / Helper(6021):onConnected:已连接!客户= 4   09-24 09:14:38.090:D / Helper(6021):已连接的客户更新为:7   09-24 09:14:38.090:D / Helper(6021):connectNextClient:请求的客户端:7,连接的客户端:7   09-24 09:14:38.090:D / Helper(6021):待定客户:0   09-24 09:14:38.090:D / Helper(6021):所有客户现已连接。登录成功!   09-24 09:14:38.090:D / Helper(6021):所有请求的客户端已连接。登录成功!   09-24 09:14:38.090:D / Helper(6021):状态改变连接 - &gt;连接的   09-24 09:14:38.090:D / Helper(6021):通知LISTENER登录成功   09-24 09:14:38.090:D / LDGame MainActivity(6021):已登录

登录时,关键说明是你应该看到&#34; D / Helper(6021):onConnectionFailed:自用户启动登录,解决问题。&#34;因为那将意味着以前工作

并注销logcat

  

09-24 09:14:52.145:D / Helper(6021):清除PlusClient上的默认帐户。   09-24 09:14:52.165:D / Helper(6021):从GamesClient注销。   09-24 09:14:52.190:D / Helper(6021):继续断开连接。   09-24 09:14:52.190:D / Helper(6021):killConnections:杀死连接。   09-24 09:14:52.190:D / Helper(6021):断开GamesClient的连接。   09-24 09:14:52.195:D / Helper(6021):断开PlusClient。   09-24 09:14:52.195:D / Helper(6021):断开AppStateClient的连接。   09-24 09:14:52.195:D / Helper(6021):killConnections:所有客户端断开连接。   09-24 09:14:52.195:D / Helper(6021):状态变化已连接 - &gt; DISCONNECTED

希望有所帮助!