アプリケーションで Google Plus ログインを使用したいと考えています。接続できましたが、現在のユーザーのプロフィール情報を取得できませんでした
@Override
public void onConnected() {
String accountName = mPlusClient.getAccountName();
mPlusClient.loadPerson(this, "me");
}
@Override
public void onPersonLoaded(ConnectionResult status, Person person) {
Log.d("onPersonLoaded - ConnectionResult", "" + status);
Log.d("onPersonLoaded - person", "" + person);
if (status.getErrorCode() == ConnectionResult.SUCCESS) {
Log.d(TAG, "Display Name: " + person.getDisplayName());
}
}
でアカウント名を取得できましたonConnected
が、onPersonLoaded
null
person
ログには次のように表示されます。
onPersonLoaded - ConnectionResult(29861): ConnectionResult{statusCode=NETWORK_ERROR, resolution=null}
onPersonLoaded - person(29861): null
ここのドキュメントから
public static final int NETWORK_ERROR
ネットワーク エラーが発生しました。再試行すると、問題が解決するはずです。
定数値: 7 (0x00000007)
しかし、何度リトライしても同じエラーが発生します。そして、これらは私が使用する許可です:
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
これを解決する方法がわからず、過去2時間探していました。どんな助けでも大歓迎です、ありがとう。