简体   繁体   English

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

[英]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.

相关问题 将Google云端硬盘实施到Android应用并从Google云端硬盘下载文件 - Google Drive Implementation to Android app and Downloading the file from Google drive 如何从Android应用下载存储在Google云端硬盘中的文件? - How to download a file stored on Google Drive from an Android app? 如何将视频格式文件从 Android 应用推送到 Google Drive? - How to push a video format file to the Google Drive from an Android app? 将文件从Android应用上传到Google驱动器 - Upload file from android app to google drive 来自谷歌驱动器的 Select 文件和 android 中的共享文件 - Select files from google drive and share file in android 如何在Android上以编程方式共享Google Drive链接? - How to programmatically share a google drive link on android? 如何在android中获取谷歌驱动器共享链接 - how to get google drive share link in android 如何仅使用Google Android应用中的Google Drive API在Google云端硬盘上创建和编辑电子表格文件? - How do I create & edit a spreadsheet file on google drive using Google Drive APIs only from my Android app? 从谷歌驱动器中读取android中的App文件夹中的文件 - Read file from App folder in android from google drive 如何将文本/纯文本文件从Google云端硬盘复制到Android App本地文件 - How to copy a text/plain file from Google Drive to Android App local File
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM