Drive API を照会するためのトークンを取得しようとする関数があります。
private void getAuthTokenBlocking() {
try {
Account account = AccountManager.get(sActivity).getAccountsByType(GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE)[0];
sToken = GoogleAuthUtil.getToken(sActivity, account.name, DriveScopes.DRIVE_READONLY);
} catch (GooglePlayServicesAvailabilityException playEx) {
Dialog alert = GooglePlayServicesUtil.getErrorDialog(
playEx.getConnectionStatusCode(),
sActivity,
AUTH_REQUEST_CODE);
alert.show();
} catch (UserRecoverableAuthException userAuthEx) {
userAuthEx.printStackTrace();
} catch (IOException transientEx) {
transientEx.printStackTrace();
} catch (GoogleAuthException authEx) {
authEx.printStackTrace();
}
}
しかし、私は常に次のエラーが発生します。
com.google.android.gms.auth.GoogleAuthException: Unknown
com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)
スコープの前に「oauth2:」を付けるなど、確認できるすべての解決策を試しました。