使用-VS权限在manifest.xml文件Android权限的权限 [英] uses-permission vs permission for android permissions in the manifest.xml file

查看:117
本文介绍了使用-VS权限在manifest.xml文件Android权限的权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到,有两种类型的清单文件中,许可和权限采用-许可如下面所示的两个;

 <允许机器人:名称=android.permission.MOUNT_UNMOUNT_FILESYSTEMS/>

 <使用-权限的Andr​​oid:名称=android.permission.WRITE_EXTERNAL_STORAG​​E/>
 

以下4权限里面做我用的时候我把它们放在我的manifest.xml文件? 使用-权限权限

  android.permission.ACCESS_NETWORK_STATE

android.permission.ACCESS_WIFI_STATE

android.permission.INTERNET对

android.permission.CHANGE_WIFI_MULTICAST_STATE
 

解决方案

有关

 <许可>
 

借助文档状态:

  

声明,可用于限制访问特定组件或本或其它应用功能的安全权限。

所以,既然您正在访问Android的权限,你想使用-许可代替。这方面的文档元素规定:

  

请求应用程序必须按顺序授予许可   它才能正常工作。

<许可> 制作自定义权限时,通常使用(例如做一个应用程序,其他应用程序可以在领带的时候,限制访问是必须的),和<使用-许可> 时使用您的应用程序确实需要它通常没有的权限。

I noticed that there are two types of permissions in the manifest file, "permission" and "uses-permission" like the two shown below;

 <permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />

 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

for the following 4 permissions which do I use when I put them in my manifest.xml file? uses-permissions or permissions?

android.permission.ACCESS_NETWORK_STATE

android.permission.ACCESS_WIFI_STATE

android.permission.INTERNET

android.permission.CHANGE_WIFI_MULTICAST_STATE

解决方案

For

<permission>

The documentation states:

Declares a security permission that can be used to limit access to specific components or features of this or other applications.

Therefore, since you are accessing Android's permissions, you want uses-permission instead. The documentation for this element states:

Requests a permission that the application must be granted in order for it to operate correctly.

<permission> is normally used when making a custom permission (e.g. when making an app that other apps can tie in to, limiting access is a must), and <uses-permission> is used when your app actually needs a permission it doesn't have normally.

这篇关于使用-VS权限在manifest.xml文件Android权限的权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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