【问题标题】:Google Play Games returns false on Social.localUser.AuthenticateGoogle Play 游戏在 Social.localUser.Authenticate 上返回 false
【发布时间】:2018-05-30 16:10:59
【问题描述】:

您好:我一直在努力让我的应用进行身份验证。我已将 APK 部署到我的 Galaxy 并发生以下情况: Unity 游戏打开,出现“连接到...”对话框,出现“Google Play”绿色对话框,对话框消失并显示加载指示器,然后我得到“错误”结果.

我在 Start() 中有以下内容:

    PlayGamesPlatform.Activate();
    PlayGamesPlatform.DebugLogEnabled = true;
    AuthenticateGoogle();

以及 AuthenticateGoogle() 中的以下内容:

private bool AuthenticateGoogle()
{
    isAuthorized = false;
    Social.localUser.Authenticate((bool result) => {
        isAuthorized = result;
        if (!result)
        {
            GameObject.Find("errText").GetComponent<Text>().text = result.ToString();
        }
    });
    return isAuthorized;
}

我使用 Unity UI 创建了一个新的 Keystore,输入了密码并构建了 .APK。然后,我在 Google Play 控制台中创建了一个新应用程序并将 .APK 上传到它。接下来我创建了一个新的游戏服务并链接了该应用程序,允许它信任该应用程序。我创建了一个排行榜。我确保我的用户在测试部分。最后,我从排行榜下的获取资源部分复制 XML 到我的 Unity 项目并构建项目,复制到我的手机。

有什么想法吗?我还能做些什么来解决身份验证与真/假结果的问题?

【问题讨论】:

  • 当我链接我的应用时,我获得了一个新的客户身份(以 .apps.googleusercontent.com 结尾)。我需要在 Unity 中做任何事情来链接我的应用程序的构建吗?

标签: c# android unity3d google-play-games


【解决方案1】:

我假设你是在你的安卓手机上测试它。

您应该尝试将其添加到您的 android mainfest:

 <activity android:name="com.google.games.bridge.NativeBridgeActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />

您可以在 Assets/Plugins/Android/AndroidMainfest.xml 中创建自定义 mainfest

将自己添加到 Google Play 控制台上的测试人员(如果应用程序处于测试阶段)并直接通过 google play 下载。 (不是测试构建和运行)

要跟踪这样的错误,您可以使用工具https://assetstore.unity.com/packages/tools/log-viewer-12047 它使用简单,您可以了解哪里出了问题。希望它会有所帮助:)

编辑:

我使用了不同的方法,但它不应该有所作为:

 public bool ConnectToGoogleServices()
{
    if (!isConnectedToGoogleServices)
    {
        {
            Social.localUser.Authenticate(success =>
                {
                    isConnectedToGoogleServices = success;
                });
        }
    }
    return isConnectedToGoogleServices;
}

【讨论】:

  • 包含的 GooglePlayGames 清单 (Assets/GooglePlayGames/Plugins/Android/GooglePlayGamesManifest.plugin) 具有您在上面引用的活动行,因此我不确定是否需要进行您指定的引用更改。我确实安装了日志查看器工具。在我的笔记上它说“正在创建 Android IPlayGames 客户端客户端”...“正在启动身份验证转换。操作:SIGN_IN 状态:ERROR_NOT_AUTHORIZED”...“有待处理的身份验证回调 - 正在启动 AuthUI”...“正在启动身份验证转换。ERROR_NOT_AUTHORIZED” ...“AuthState == Unathenticating 调用 auth 回调失败。”似乎没有什么特别突出的。
猜你喜欢
  • 2018-12-14
  • 2019-02-08
  • 2014-01-16
  • 2014-05-29
  • 2016-02-04
  • 2014-05-09
  • 2014-02-02
  • 1970-01-01
相关资源
最近更新 更多