【发布时间】:2015-01-30 00:54:29
【问题描述】:
我已使用极简代码示例将 Google 游戏服务与我的 NDK 游戏集成。
启动应用程序时,身份验证失败并在日志中显示:
V/GamesNativeSDK( 7212): Play Games callback indicates connection failure.
I/GamesNativeSDK( 7212): UI interaction required to connect to Google Play.
I/TeapotNativeActivity( 7212): Sign in finished with a result of -3
I/biplane ( 7212): OnAuthActionFinished
I/biplane ( 7212): You are not logged in!
I/TeapotNativeActivity( 7212): Fetching all blocking
I/TeapotNativeActivity( 7212): --------------------------------------------------------------
I/TeapotNativeActivity( 7212): Fetching all nonblocking
I/TeapotNativeActivity( 7212): --------------------------------------------------------------
I/TeapotNativeActivity( 7212): Achievement response status: -3
我已执行在线文档中列出的所有步骤,包括:
- 在 Google Play Developer Console 中创建了一个游戏服务并关联了两个应用。
- 使用 Debug 键链接的应用
- 带有 Release 键的链接器应用
- 从链接的应用程序中获取 app-id(两个链接的应用程序的 id 相同)并将其放入 res/values/ids.xml 中
- 创建排行榜,并将其 ID 放入 res/values/game-ids.xml
- 在我的 AndroidManifest.xml 中添加了 name="com.google.android.gms.games.APP_ID" 和 value="@string/app_id" 的标签
- 已下载游戏服务应用的最新更新。
- 将自己列为测试用户。
我不确定哪个消息是原始错误,哪个是症状。 “连接失败”或“需要 UI 交互”。
请注意,在开发者控制台中,两个链接的应用被列为“准备发布”。
我使用的源代码是来自 c++ 代码示例的 StateManager.cpp 的逐字副本,在我的 android_main 中我也复制了示例代码 sn-p:
// gpg-cpp: Here we create the callback on auth operations
auto callback = [&](gpg::AuthOperation op, gpg::AuthStatus status) {
LOGI("OnAuthActionFinished");
if (IsSuccess(status)) {
LOGI("You are logged in!");
} else {
LOGI("You are not logged in!");
}
//engine.animating = 1;
};
if (state->savedState != NULL)
{
// We are starting with a previous saved state; restore from it.
engine.state = *(struct saved_state*)state->savedState;
LOGI("Restored state");
}
else
{
LOGI( "No saved state to restore." );
gpg::AndroidPlatformConfiguration platform_configuration;
platform_configuration.SetActivity(state->activity->clazz);
// Now, create the game service (see StateManager.cpp) and pass in callback
StateManager::InitServices(platform_configuration, NULL, callback);
}
【问题讨论】:
标签: android-ndk google-play-services google-play-games