com.google.api.client.extensions.android.http.androidhttp已过时

5

你好!我尝试在 Android 应用程序中使用 Google Drive API 进行通信,但我发现这个 API 已经被 Google 废弃了。我该如何修改我的代码呢?

    void fun(GoogleSignInAccount signInAccount){
    Log.d("jjj","fun called");
    GoogleAccountCredential credential =
            GoogleAccountCredential.usingOAuth2(
                    this, Collections.singleton(DriveScopes.DRIVE_FILE));
    credential.setSelectedAccount(signInAccount.getAccount());
    Drive googleDriveService =
            new Drive.Builder(
                    AndroidHttp.newCompatibleTransport(),
                    new GsonFactory(),
                    credential)
                    .setApplicationName("Drive API Migration")
                    .build();
    editor.putBoolean("SyncOn",true).commit();
    mDriveServiceHelper = new DriveServiceHelper(googleDriveService);

问题截图: 过时代码截图 - 行号问题

1个回答

10

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接