如何从Android应用程序共享Google Drive文件?

时间:2014-06-18 12:46:50

标签: android google-drive-api google-drive-android-api

我的Android应用使用新的Google云端硬盘API在Google云端硬盘上创建文件。我成功获得了DriveFile对象。

问题是:如何从我的应用分享此文件?赞赏相关主题的链接,特别是代码示例。

2 个答案:

答案 0 :(得分:3)

特定于Android的API尚不支持共享。您可以使用RESTful Web API执行此操作。请参阅permissions

您可以从DriveId获取resourceId,这是您在Web API中访问文件所需的ID。

答案 1 :(得分:1)

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);
}