Authorizing my application to use an Existing Folder

前端 未结 4 969
梦如初夏
梦如初夏 2021-01-14 00:14

Using the Android Drive API, when trying to connect using:

mGoogleApiClient = new GoogleApiClient.Builder(this)
            .addApi(Drive.API).addScope(Drive         


        
4条回答
  •  半阙折子戏
    2021-01-14 00:57

    Google Drive Android API only support two scopes:

    drive.file: (https://www.googleapis.com/auth/drive.file) Per-file access to files created or opened by the app

    drive.appdata (https://www.googleapis.com/auth/drive.appdata) Allows access to the Application Data folder

    You need to use the Google Drive web service (https://developers.google.com/drive/v2/reference/) and your application must use the Google APIs Client Library for Java. (https://code.google.com/p/google-api-java-client)

    The scope for full access: "https://www.googleapis.com/auth/drive"

    GoogleAccountCredential credential = GoogleAccountCredential.usingOAuth2(this, DriveScopes.DRIVE); 
    credential.setSelectedAccountName(accountName); 
    Drive service = new Drive.Builder(AndroidHttp.newCompatibleTransport(), new GsonFactory(), credential).build();
    

提交回复
热议问题