它看起來像這樣不能與表API v4的工作要做。
但是......它看起來像它可以與兼容谷歌雲端硬盤API V3來完成。
注:這個解決方案最好的部分是,我可以使用的身份驗證和證書收集的同樣的方法爲兩種API。例如,一旦我有獲得證書的代碼,我可以用其來進行API的交替和連續。
這裏就是我所做的:
將此添加到我的build.gradle
(我下面的表API聲明所示)
compile('com.google.apis:google-api-services-sheets:v4-rev468-1.22.0') {
exclude group: 'org.apache.httpcomponents'
}
compile('com.google.apis:google-api-services-drive:v3-rev69-1.22.0') {
exclude group: 'org.apache.httpcomponents'
}
我已經使用獲取帳戶和憑據EasyPermissions
方法。 Great example here。
則...
import com.google.api.services.drive.Drive;
...
protected Drive driveService = new Drive.Builder(transport, jsonFactory, credential)
.setApplicationName("My Application Name")
.build();
...異步:
private DateTime getSheetInformation() throws IOException {
String spreadsheetId = settings.getSpreadsheetId();
Drive.Files.Get fileRequest = driveService.files().get(spreadsheetId).setFields("id, modifiedTime");
File file = fileRequest.execute();
if (file != null) {
return file.getModifiedTime();
}
return null;
}
我想我會加入我自己的答案給別人(後下) ,但我肯定會給你信貸。有時候知道「你不能!」是很重要的。另外,去哪裏(Drive API files.get)。非常感謝你! – LimaNightHawk