2

AppdataPreferencesで承認を実装できませんでした。Github のドキュメントに従っていますが、セットアップ後にユーザーに許可を求めません。

GoogleAccountCredential credential =
    GoogleAccountCredential.usingOAuth2(this, "https://www.googleapis.com/auth/drive.appdata");
credential.setSelectedAccountName(emailAddress);

足りないものはありますか?

4

1 に答える 1

2

次のように、正しい例外をキャッチし、認証ダイアログをユーザーに表示する必要があります。

syncer.setOnUserRecoverableAuthExceptionListener(
    new OnUserRecoverableAuthExceptionListener() {
  @Override
  public void onUserRecoverableAuthException(
        final UserRecoverableAuthIOException e) {
    // show user a notification to ask for permissions again.
    startActivityForResult(e.getIntent(), 123);
  }
});
于 2013-05-20T17:50:26.360 に答える