问题描述
我需要解析应用程序的 AndroidManifest.xml ,以找出客户端应用程序与该应用程序进行通信所需拥有的权限.根据 Android开发人员指南 application 标签和组件(活动,服务,提供者,接收者)标签的strong> android:permission 属性.
I have a requirement to parse the AndroidManifest.xml of an app to find out what permissions a client app need to possess in order to communicate with this app. As per android developer guidelines the permission mentioned in the android:permission attribute of application tag and component (Activity, Service, Provider, Receiver) tag is supposed to be possessed by the client app. An example (AndroidManifest.xml excerpt) of this usage is
<application android:permission="android.permission.INTERNET">
...
</application>
在上述示例中,客户端应用应具有 android.permission.INTERNET 以便与此应用进行通信.
In the aforementioned example, the client app should possess android.permission.INTERNET in order to communicate with this app.
我的问题是,在标签的属性中提到了此许可信息.因此,我了解(可能是错误的),在这里不可能有一个以上的权限.但是,一个应用程序/组件很有可能期望客户端应用程序/组件拥有多个这样的许可.例如,在上述情况下,应用程序可能期望客户端应用程序同时拥有android.permission.INTERNET和android.permission.ACCESS_WIFI_STATE权限.但是似乎没有空间在AndroidManifest.xml中指定此内容.
My question is, this permission information is mentioned in the attribute of a tag. Hence I understand (I might be wrong) it is not possible to have more than one permission to be mentioned here. But it is quite possible that an app/ component could expect the client app/ component to possess more than one such a permission. For example, in the aforementioned case, the app could expect both android.permission.INTERNET and android.permission.ACCESS_WIFI_STATE permissions to be possessed by the client app. But there seems to be no room to specify this in the AndroidManifest.xml.
请让我知道,是否有可能要求客户端应用程序拥有多个许可.
Please let me know whether it is possible to mandate the possession of more than one permission by a client app.
推荐答案
正确.
正确.
从技术上讲,这是不可能的,因为应用程序可以在运行时检查权限(例如,通过调用checkCallingPermission()
).
Technically, this is not possible, as apps can check for permissions at runtime (e.g., by calling checkCallingPermission()
).
这篇关于android:permisson中的多个权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!