简体   繁体   English

Google Drive API清单权限

[英]Google Drive API Manifest Permissions

this isn't really a big problem. 这不是一个大问题。 I've got an Android App that stores user's passwords on a SQLite Database. 我有一个Android应用程序,用于在SQLite数据库上存储用户的密码。 So last week I launched an update that allows the user to export those passwords to their Google Drive. 因此,上周我发布了一个更新,允许用户将这些密码导出到他们的Google云端硬盘。 To do this, I've used the Google Drive Android API . 为此,我使用了Google云端硬盘Android API I didn't add any special permission to the Application Manifest (AndroidManifest.xml) and it works fine (tested on KitKat4.4). 我没有向Application Manifest(AndroidManifest.xml)添加任何特殊权限,它工作正常(在KitKat4.4上测试)。 But one of my friends told me that it might not work on Android 6.0+, because I should always ask for permissions. 但我的一位朋友告诉我,它可能无法在Android 6.0+上运行,因为我应该总是要求权限。 But I checked some samples and none of them had those permissions on the Manifest. 但我检查了一些样本,但没有一个在Manifest上有这些权限。 Do you guys think it's necessary to add permissions? 你们认为有必要添加权限吗? Perhaps INTERNET or GET_ACCOUNTS? 也许INTERNET或GET_ACCOUNTS?

If you are using the Google Drive Android API you don't need INTERNET or GET_ACCOUNTS permissions. 如果您使用的是Google云端硬盘Android API ,则不需要INTERNETGET_ACCOUNTS权限。

The API automatically handles previously complex tasks such as offline access and syncing files. API自动处理以前复杂的任务,如脱机访问和同步文件。 This allows you to read and write files as if Drive were a local file system. 这使您可以读取和写入文件,就像Drive是本地文件系统一样。

Check the official Quickstart and the demos sample on GitHub. 查看官方快速入门和GitHub上的演示示例。 None of them is having special permissions in the AndroidManifest.xml. 他们都没有在AndroidManifest.xml中拥有特殊权限。

BUT if you are using the Google Drive REST API for Android then you need INTERNET permission for sure. 但是,如果您使用Android版Google Drive REST API ,那么您肯定需要INTERNET权限。

If you follow the tutorials on Drive API using Android, you will see in the Step 4:Prepare the project that you need to add the permissions below in your code. 如果您按照Android上的Drive API使用教程,您将在步骤4:准备项目中看到您需要在代码中添加以下权限。

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />

The permission "android.permission.INTERNET" is used if you want your application to connect/perform network operation. 如果您希望应用程序连接/执行网络操作,则使用权限"android.permission.INTERNET"

For the "android.permission.GET_ACCOUNTS" , it's stated in this documentation that: 对于"android.permission.GET_ACCOUNTS" ,本文档中说明:

Note: Beginning with Android 6.0 (API level 23), if an app shares the signature of the authenticator that manages an account, it does not need "GET_ACCOUNTS" permission to read information about that account. 注意:从Android 6.0(API级别23)开始,如果应用程序共享管理帐户的身份验证器的签名,则不需要"GET_ACCOUNTS"权限来读取有关该帐户的信息。 On Android 5.1 and lower, all apps need "GET_ACCOUNTS" permission to read information about any account. 在Android 5.1及更低版本中,所有应用都需要"GET_ACCOUNTS"权限才能阅读有关任何帐户的信息。

For more information about different meaning/uses of android permission, check this page . 有关android权限的不同含义/用途的更多信息,请查看此页面

According to the Google Maps API documentation , INTERNET and ACCESS_NETWORK_STATE permissions will be automatically merged to project's manifest, meaning you don't have to specify them by yourself as long as calling API over Google Play services. 根据Google Maps API文档INTERNETACCESS_NETWORK_STATE权限将自动合并到项目的清单中,这意味着只要通过Google Play服务调用API,您就不必自己指定它们。
Couldn't find the same description for Google Drive API, though. 但是,找不到Google Drive API的相同说明。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM