简体   繁体   English

如何使用Google Drive Android API更改在Google云端硬盘中创建的文件夹或文件的权限?

[英]How to change permission of folder or file created in Google Drive using Google Drive Android API?

I'm using Google Drive Android API to store and share files and folders created. 我正在使用Google Drive Android API来存储和共享创建的文件和文件夹。 When I create a file/folder using Google Drive Android API ,by default created file or folder is private (not shared publicly) . 当我使用Google Drive Android API创建文件/文件夹时,默认情况下创建的文件或文件夹是私有的(不公开共享)

When I share the link of file/folder created to any user, that user needs to send email request for access to owner. 当我与任何用户共享创建的文件/文件夹的链接时,该用户需要发送电子邮件请求以访问所有者。 So owner have to make file/folder public manually in Google Drive to prevent access requests. 因此,所有者必须在Google云端硬盘中手动公开文件/文件夹,以防止访问请求。

Where as for Google Drive iOS API , when a file/folder is created, the file/folder created is by default public . 对于Google Drive iOS API ,在创建文件/文件夹时,默认情况下创建的文件/文件夹是公共的

Another question I want to ask is, When I am querying list of folders in Root folder (with MIME_TYPE as application/vnd.google-apps.folder ), the result is given with all folders. 我想问的另一个问题是,当我查询Root文件夹中的文件夹列表( MIME_TYPEapplication/vnd.google-apps.folder )时,结果将与所有文件夹一起提供。 Where as using Google Drive iOS API , queryForFilesList() method returns only folders created by particular iOS app, not all folders in the root directory. 在使用Google Drive iOS APIqueryForFilesList()方法仅返回由特定iOS应用创建的文件夹,而不返回根目录中的所有文件夹。

What I have to do to get this kind of result using Google Drive Android API or Google Drive REST API ? 我需要做些什么才能使用Google Drive Android APIGoogle Drive REST API获得此类结果?

Per DaImTo's comment: Per DaImTo的评论:
You can use GDAA and REST together, I have a side-by-side CRUD implementations published here and here . 你可以一起使用GDAAREST ,我在这里这里发布并行的CRUD实现。 You must be aware of a few things, though: 但是你必须知道一些事情:

1/ The 'connect' in the GDAA is not aligned with the 'UserRecoverableAuthIOException' logic of the REST See init ()/ connect () combo in the two examples. 1 / GDAA中的'connect'与REST的'UserRecoverableAuthIOException'逻辑不一致请参阅两个示例中的init ()/ connect ()组合。 Actually, you can use GDAA's 'connect' logic to do the authorization and then continue using the REST service. 实际上,您可以使用GDAA的“连接”逻辑来执行授权,然后继续使用REST服务。 The 'UserRecoverableAuthIOException' should still be handled in case your user messes with the ' Settings > Manage Apps > Disconnect From Drive '. 如果您的用户使用“ 设置”>“管理应用”>“从驱动器断开连接 ”,则仍应处理“UserRecoverableAuthIOException”。 But then, your app is DOA anyway if it is under the FILE scope. 但是,如果它在FILE范围内,那么你的应用程序无论如何都是DOA。

2/ The GDAA uses DriveId as a primary ID that is local to a device. 2 / GDAA使用DriveId作为设备本地的主ID。 It has access to the ResourceId (with some latency) that is primary ID in REST. 它可以访问作为REST中主要ID的ResourceId(具有一些延迟)。 The ResourceID is a system-wide ID that can be ported to different devices, systems. ResourceID是一个系统范围的ID,可以移植到不同的设备,系统。 See here and here . 看到这里这里

3/ The REST API is broader, the GDAA is build on top of it and has only a subset of functionality (no thumbnail link for instance). 3 / REST API更广泛,GDAA构建在它之上,并且只有一部分功能(例如没有缩略图链接)。 It supports FILE scope only (as opposed to DRIVE and FILE scopes of the REST). 它仅支持FILE范围(与REST的DRIVE和FILE范围相对)。

4/ When you start mixing the 2 together, you will be exposed to latency/timing issues, since your app has full control over the REST's networking, whereas GDAA's synchronization is hidden with some vaguely documented sync methods . 4 /当您开始将2混合在一起时,您将面临延迟/时间问题,因为您的应用程序可以完全控制REST的网络,而GDAA的同步隐藏在一些模糊记录的同步方法中

If you look closer at the GDAA's architecture here ( Lifecycle of a Drive file ) , you will figure out potential pitfalls of mixing the two. 如果你仔细观察GDAA的架构( 驱动器文件的生命周期 ),你会发现混合这两者的潜在缺陷。

Good Luck 祝好运

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用Google Drive Android API删除Google Drive上的文件 - How to delete a file on google drive using Google Drive Android API 如何使用 API 在 Google Drive 上创建文件夹和文件? 安卓 - How to create a folder and a file on Google Drive using API? Android 如何在Google Drive Android API中获取已创建文件夹的DriveId - How to get DriveId of created folder in Google Drive Android API 使用Android中的Google Drive API获取在Google Drive上创建的文件的大小 - Get size of file created on Google drive using Google drive api in android 适用于Android的云端硬盘API:如何列出Google云端硬盘文件夹中的每个条目(以及不是由我的应用创建的条目) - Drive API for Android: how to list every entry in Google Drive folder (also those not created by my app) 如果使用google drive Api在android中的google drive中不存在,如何创建文件夹? - how to create folder if not exist in google drive in android using google drive Api? 如何使用Android Google Drive sdk将文件上传到Google Drive文件夹 - How to upload a file to google drive folder using android google drive sdk 谷歌驱动器配额使用android api驱动器 - google drive quota using android api for drive 如何使用谷歌驱动器android api同步驱动器的文件夹? 什么是透明脱机同步? - how to sync a folder with drive using google drive android api? What is Transparent offline Sync? 如何使用 Google Drive API 从 android 将加密的图像文件上传到 Google Drive - How to upload encrypted image file on google drive from android using Google Drive API
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM