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

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

问题描述

我正在使用 Drive Android API (com.google.android.gms.drive.DriveApi) 创建一个应用程序,以在 Google Drive 上上传/下载/共享文件.这是我正在关注的示例代码的 URL:https://github.com/googledrive/android-demos/tree/master/src/com/google/android/gms/drive/sample/demo

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

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

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.

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

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.

我用谷歌搜索,但发现大多数使用 JAVA API 的示例需要 OAuth 或 API 密钥设置.

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

如果有人知道如何使用 Android API 解决此问题,请提供帮助.

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

提前致谢!

推荐答案

此功能目前在 Android 特定的 API 中不可用.您可以改为将 REST API 用于应用的这一部分,如 Java API 中所述授权客户.

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.

如果您有文件的 DriveId,您可以从中获取资源 ID,您可以使用它在 Java REST API 中发出请求.

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 设置 Drive 文件的权限 (com.google.android.gms.drive.DriveApi)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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