Google Play游戏在Social.localUser.Authenticate上返回false

问题描述 投票:1回答:1

您好:我一直在努力让我的应用程序进行身份验证。我已将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从排行榜下的Get resources部分复制到我的Unity项目并构建项目,复制到我的手机。

有任何想法吗?我可以做任何其他事情来解决身份验证与真/假结果的问题?

c# android unity3d google-play-games
1个回答
2
投票

我假设你在Android手机上测试它。

您应该尝试将此添加到您的Android清单:

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

您可以在Assets / Plugins / Android / AndroidManifest.xml中创建自定义清单

将自己添加到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;
}
© www.soinside.com 2019 - 2024. All rights reserved.