它看起来像这样不能与表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