使用Android API设置云端硬盘文件的权限(com.google.android.gms.drive.DriveApi) [英] Setting permission on Drive file using Android APIs (com.google.android.gms.drive.DriveApi)

查看:280
本文介绍了使用Android API设置云端硬盘文件的权限(com.google.android.gms.drive.DriveApi)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Drive Android API(com.google.android.gms.drive.DriveApi)创建应用以在Google云端硬盘上上传/下载/共享文件。以下是我所遵循的代码示例网址: https://github.com/googledrive/android-demos/tree/master/src/com/google/android/gms/drive/sample/demo



API客户端(com.google.android.gms.common.api.GoogleApiClient)提示用户在连接到Google服务时选择一个帐户,因此我没有用户凭据。

我可以使用Android API(com.google.android.gms.drive.DriveApi)上传/下载文件,但没有设置文件权限的API,以便用户可以与公众分享。示例代码也没有任何示例来设置文件权限。



我使用了Google搜索,但大多数都使用JAVA API,这些API需要安装OAuth或API Key。



如果有人知道如何使用Android API解决此问题,请协助。



p>

解决方案

Android特定的API目前不提供此功能。您可以改为使用REST API处理您应用的这部分内容,并按照 Java API客户端



如果您有文件的DriveId,您可以从中获取resourceId,您可以使用它来在Java REST API中创建请求。


I am creating an App using Drive Android APIs (com.google.android.gms.drive.DriveApi) to upload/download/share files on Google Drive. Here's the URL to sample code I am following: https://github.com/googledrive/android-demos/tree/master/src/com/google/android/gms/drive/sample/demo

The API client (com.google.android.gms.common.api.GoogleApiClient) prompts the user to choose an account when connecting to Google services, so I don't have user's credentials.

I am able to upload/download files using Android APIs (com.google.android.gms.drive.DriveApi), but there's no API to set the file permission, so that user can share it with public. The sample code too doesn't have any example to set file permission.

I googled, but found mostly examples that uses JAVA APIs which will require OAuth or API Key setup.

If anyone knows how to resolve this using Android APIs, please help.

Thanks in advance!

解决方案

This feature is not currently available in the Android-specific API. You can instead use the REST API for this portion of your app, authorized as described in the Java API Client.

If you have a DriveId for the file, you can get the resourceId from it which you can use to make the requests in the Java REST API.

这篇关于使用Android API设置云端硬盘文件的权限(com.google.android.gms.drive.DriveApi)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆