对于 Google Play 游戏服务示例,如果您使用具有多个 Google 帐户的 Gingerbread 设备,您将无法登录。GameHelper 无法登录,您会陷入永无止境的“登录屏幕”循环。
如果打开 GameHelper.java 并注释掉第 417 行:mExpectingResolution = false;
..那么你就可以真正登录了。但这也会导致我的游戏崩溃。
Google Play 服务和一个新的类 GameHelper 与 android 2.3 上的示例 ButtonClicker2000 无法登录到您的帐户。当出现用户选择的对话框(登录对话框)时,方法 onStop()。
/** Call this method from your Activity's onStop(). */
public void onStop() {
debugLog("onStop");
assertConfigured("onStop");
if (mGoogleApiClient.isConnected()) {
debugLog("Disconnecting client due to onStop");
mGoogleApiClient.disconnect();
} else {
debugLog("Client already disconnected when we got onStop.");
}
mConnecting = false;
mExpectingResolution = false;
// let go of the Activity reference
mActivity = null;
}
选择用户后调用 onStart()。但是,没有登录。相反,开发对话框(登录对话框)会随着用户的选择重新出现。如此无限期地。
/** Call this method from your Activity's onStart(). */
public void onStart(Activity act) {
mActivity = act;
mAppContext = act.getApplicationContext();
debugLog("onStart");
assertConfigured("onStart");
if (mConnectOnStart) {
if (mGoogleApiClient.isConnected()) {
Log.w(TAG,
"GameHelper: client was already connected on onStart()");
} else {
debugLog("Connecting client.");
mConnecting = true;
mGoogleApiClient.connect();
}
} else {
debugLog("Not attempting to connect becase mConnectOnStart=false");
debugLog("Instead, reporting a sign-in failure.");
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
notifyListener(false);
}
}, 1000);
}
}
GameHelper 中的登录循环错误是否有任何修复?
来源在这里:https ://github.com/playgameservices/android-basic-samples