问题
In BaseDemoActivity.java from Google Drive Demo app
https://github.com/googledrive/android-demos/blob/master/src/com/google/android/gms/drive/sample/demo/BaseDemoActivity.java
what i have replace in EXISTING_FOLDER_ID
,EXISTING_FILE_ID
,EXTRA_ACCOUNT_NAME
Please provide steps to get this values
/**
* DriveId of an existing folder to be used as a parent folder in
* folder operations samples.
*/
public static final String EXISTING_FOLDER_ID = "????";
/**
* DriveId of an existing file to be used in file operation samples..
*/
public static final String EXISTING_FILE_ID = "????";
/**
* Extra for account name.
*/
protected static final String EXTRA_ACCOUNT_NAME = "????";
Thanks
回答1:
The first part, EXISTING_FOLDER_ID,EXISTING_FILE_ID, is answered in SO 21800257, but be careful. You can't just go to a web Drive interface, create a file, copy/paste its resource id ... Google Drive Android API (GDAA) supports only FILE scope, so only files, folders created by your Android App are eligible.
EXTRA_ACCOUNT_NAME is a name of your Google (gmail) account (myaccount@gmail.com). That's the one you would need here:
GoogleApiClient mGac = new GoogleApiClient.Builder(contex)
.addApi(com.google.android.gms.drive.Drive.API)
.addScope(com.google.android.gms.drive.Drive.SCOPE_FILE)
.setAccountName(EXTRA_ACCOUNT_NAME)
.addConnectionCallbacks(context).addOnConnectionFailedListener(context)
.build();
but I'm not sure the demo even addresses this. You would use it if your Android App allowed switching between different accounts.
来源:https://stackoverflow.com/questions/27466683/android-google-drive-existing-folder-id-existing-file-id