[英]How to share Google Drive file from Android app?
My Android app creating a file on Google Drive using new Google Drive API. 我的Android应用使用新的Google云端硬盘API在Google云端硬盘上创建文件。 I'm getting DriveFile object successfully.
我成功获得了DriveFile对象。
The question is: how to share this file from my app? 问题是: 如何从我的应用程序共享此文件? Links to relevant topics and especially code samples are appreciated.
欢迎链接到相关主题,特别是代码示例。
The Android-specific API does not yet support sharing. 特定于Android的API尚不支持共享。 You can use the RESTful web API to do this.
您可以使用RESTful Web API执行此操作。 See permissions .
查看权限 。
From a DriveId you can get the resourceId, which is the id you need in order to access a file in the web API. 在DriveId中,您可以获取resourceId,这是您访问Web API中的文件所需的ID。
Permission newPermission = new Permission();
newPermission.setValue(emailvalue);
newPermission.setType(type);
newPermission.setRole(role);
try {
service.permissions().insert(fid, newPermission).execute();
showToast("Done Shared successfully!!!!!!");
} catch (IOException e) {
System.out.println("An error occurred: " + e);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.