Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/183.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Google Play Games在Social.localUser.Authenticate上返回false_C#_Android_Unity3d_Google Play Games - Fatal编程技术网

C# Google Play Games在Social.localUser.Authenticate上返回false

C# Google Play Games在Social.localUser.Authenticate上返回false,c#,android,unity3d,google-play-games,C#,Android,Unity3d,Google Play Games,你好:我一直在努力让我的应用程序进行身份验证。我已经将APK部署到我的Galaxy中,发生了以下情况:Unity游戏打开,“连接到…”对话框出现,“Google Play”绿色对话框出现,对话框随着加载指示器消失,然后我得到一个“false”结果 我在Start()中有以下内容: 以及AuthenticateGoogle()中的以下内容: private bool AuthenticateGoogle() { 未授权=错误; Social.localUser.Authenticate((bool

你好:我一直在努力让我的应用程序进行身份验证。我已经将APK部署到我的Galaxy中,发生了以下情况:Unity游戏打开,“连接到…”对话框出现,“Google Play”绿色对话框出现,对话框随着加载指示器消失,然后我得到一个“false”结果

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

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

private bool AuthenticateGoogle()
{
未授权=错误;
Social.localUser.Authenticate((bool结果)=>{
未授权=结果;
如果(!结果)
{
GameObject.Find(“errText”).GetComponent().text=result.ToString();
}
});
返回被授权;
}
我使用Unity UI创建了一个新的密钥库,输入密码并构建了.APK。然后我在Google Play控制台中创建了一个新的应用程序,并将.APK上传到其中。接下来,我创建了一个新的游戏服务并链接了该应用程序,使其能够信任该应用程序。我创建了一个排行榜。我确保我的用户在测试部分。最后,我将Leadboard下的Get resources部分的XML复制到我的Unity项目中,并构建了该项目,复制到我的手机上


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

我假设您正在android手机上测试它

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

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

包含的GooglePlayGames清单(Assets/GooglePlayGames/Plugins/Android/GooglePlayGamesManifest.plugin)包含您上面引用的活动行,因此我不确定是否需要进行您指定的引用更改。我确实安装了日志查看器工具。在我的笔记中,它表示“正在创建Android IPlayGames客户端”…“正在启动身份验证。Op:SIGN_IN status:ERROR_NOT_AUTHORIZED”…“正在启动身份验证回调”…“正在启动身份验证转换。ERROR_NOT_AUTHORIZED”…“authostate==取消身份验证调用失败的身份验证回调。”似乎没有什么突出的地方。当我链接我的应用程序时,我得到了一个新的客户身份(以.apps.googleusercontent.com结尾)。我需要在Unity中使用它来链接我的应用程序的构建吗?
private bool AuthenticateGoogle()
{
    isAuthorized = false;
    Social.localUser.Authenticate((bool result) => {
        isAuthorized = result;
        if (!result)
        {
            GameObject.Find("errText").GetComponent<Text>().text = result.ToString();
        }
    });
    return isAuthorized;
}
 <activity android:name="com.google.games.bridge.NativeBridgeActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
 public bool ConnectToGoogleServices()
{
    if (!isConnectedToGoogleServices)
    {
        {
            Social.localUser.Authenticate(success =>
                {
                    isConnectedToGoogleServices = success;
                });
        }
    }
    return isConnectedToGoogleServices;
}