Android、Google認証の問題があります( .GoogleAuthException: Unknown while doing Google SSO. - no Answerに似ています):
09-29 00:04:38.328: W/System.err(15623): com.google.android.gms.auth.GoogleAuthException: Unknown
09-29 00:04:38.328: W/System.err(15623): at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)
次のコードを実行すると再現可能です。
String scopesString = Scopes.PLUS_LOGIN + " " + Scopes.PLUS_PROFILE;
String scopes = "oauth2:server:client_id:" + Consts.GOOGLE_PLUS_SERVER_CLIENT_ID + ":api_scope:" + scopesString;
OR
String scopes = "audience:server:client_id:" + Consts.GOOGLE_PLUS_SERVER_CLIENT_ID;
Bundle appActivities = new Bundle();
appActivities.putString(GoogleAuthUtil.KEY_REQUEST_VISIBLE_ACTIVITIES, "http://schemas.google.com/AddActivity http://schemas.google.com/BuyActivity");
GoogleAuthUtil.getToken(activity, accountName, scopes, appActivities);
以下にいくつかの注意事項を示します。
- GoogleAuthUtil.getToken(activity, accountName, "oauth2:" + scopesString) でアクセストークンを取得できます
- activity != null, client_id = 123456789.apps.googleusercontent.com, accountName は有効なメールです (アカウント ピッカーで選択)
- http://plus.google.com/u/0/appsのaccountName には、私のプロジェクトに関する記録があります: <Project Name> ------- アプリと購入活動--------あなたのサークル
- 私は持っている
android.permission.GET_ACCOUNTS
- appActivities.putString(GoogleAuthUtil.KEY_REQUEST_VISIBLE_ACTIVITIES, "") での同じ例外
- GoogleAuthUtil.getToken(activity, accountName, scopes) での同じ例外
解決した
- インストール済みアプリ (Android) とサービス 1 の 2 つのクライアント ID が必要です。ここではサービス 1 を使用する必要があります。
- 次に、UserRecoverableAuthException: NeedPermission を取得します。例外を処理する必要があります
つまり、このように:
} catch (UserRecoverableAuthException e) {
activity.startActivityForResult(e.getIntent(), REQUEST_AUTHORIZATION);
}