问题
I am having a look at here from github.
I can create a file and a folder successfully by reading the code provided in github. But I am not being able to edit the file or create a file/folder in any specific folder.
The main problem would be using emulator, but I am not sure. I am using GenyMotion
I have also copied the ID of a file/folder using
showMessage("Created a file in App Folder: "
+ result.getDriveFile().getDriveId());
and
showMessage("Created a folder: " + result.getDriveFolder().getDriveId());
lines of code .
Then I changed
public static final String EXISTING_FOLDER_ID = "CAESABjACiCShczj8lI=";//changed this
public static final String EXISTING_FILE_ID = "0ByfSjdPVs9MZTHBmMVdSeWxaNTg";
of BaseActivity. Still I am getting the same output.
"Cannot find DriveId. Are you authorized to view this file?"
Can anyone point me what am I doing wrong here?
Thank you!!
回答1:
I do believe that 'result.getDriveFile().getDriveId()' gives you a 'DriveId', an ID used by GDAA only. The 'EXISTING_FILE_ID' refers to another ID, so called ResourceID. You have to use that one. See SO 21800257. The ResourceId is the original ID used in older RESTful API, and the only one that you can use when referring to the Drive object across different devices (DriveID is device specific). ResourceID can also be seen as a part of the URL address of the object.
BTW. the shortest answer to your question is:
result.getDriveFile().getDriveId().getResourceId();
But you may get NULL if you're too quick see SO 22874657 .
Good Luck.
来源:https://stackoverflow.com/questions/28690401/cannot-find-driveid-are-you-authorized-to-view-this-file-even-if-existing-f