GoogleSignIn可以使用,但是Google_DEFAULT_GAMES没有

时间:2018-06-09 16:09:25

标签: java android google-play-games android-googleapiclient

当我从默认登录选项中调用GoogleSignInOptions时,我会显示一个signIn UI

GoogleSignInOptions ClientInfo = GoogleSignInOptions.Builder.(GoogleSignInOptions.DEFAULT_SIGN_IN).requestEmail().build();
GoogleSignInClient mGoogleSignInClient = GoogleSignInClient.getClient(this, ClientInfo);
Intent SignInintent = mGoogleSignInClient.getSignInIntent();
startActivityForResult(SignInintent,3000);

但是,如果我使用默认游戏登录GoogleSignInOptions。我根本没有显示任何用户界面我得到一个昏暗的灯光,就好像它想要显示但是它消失了。

GoogleSignInOptions ClientInfo = GoogleSignInOptions.Builder. GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN).requestEmail().build();
GoogleSignInClient mGoogleSignInClient = GoogleSignInClient.getClient(this, ClientInfo);
Intent SignInintent = mGoogleSignInClient.getSignInIntent();
startActivityForResult(SignInintent,3000);

2 个答案:

答案 0 :(得分:0)

我遇到同样的问题,很想知道这个问题的答案

答案 1 :(得分:0)

我有同样的问题。对https://developers.google.com/games/services/android/troubleshooting中列出的SHA-1,packageName和其他可能的问题的检查未产生任何有效的结果。通过将直接写入字符串资源中的元数据的app_id移至解决了我的问题。真的,我不知道为什么,但是可以。

之前:

AndroidManifest.xml:

<meta-data
        android:name="com.google.android.gms.games.APP_ID"
        android:value="XXXXXXXXXXXX" />

之后:

AndroidManifest.xml:

<meta-data
        android:name="com.google.android.gms.games.APP_ID"
        android:value="@string/app_id" />

res / values / games_ids:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- app_id -->
    <string name="app_id" translatable="false">XXXXXXXXXXXX</string>
</resources>