您好,我尝试与Android应用程序上的Google Drive 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);
代替AndroidHttp
,直接使用NetHttpTransport
或切换到更好支持的Cronet。
参考:NetHttpTransport