机器人:允许上述&lt;用途&gt; [英] android:permission in <application>
问题描述
我注意到,Android框架允许 安卓权限
在&lt;应用&GT;
。
例如,请考虑下面的清单文件。
I have noticed that Android framework allows android:permission
in <application>
.
For example, consider the following manifest file.
<application android:permission="android.permission.INTERNET">
...
</application>
在上面的例子中,要发动我的应用程序启动器应用程序(例如,主屏幕)需要网络
许可。在现实中,没有一个权限保护自己的应用程序(我可能是错在这里)。但是,我真的不明白它的实际使用情况。我们什么时候会使用&LT的权限;用途&gt;
?
In the above example, to launch my application the launcher app (e.g., home screen) needs INTERNET
permission. In reality, no one permission protect their application (I may be wrong here). But, I really don't understand the practical use-case of it. When will we use permissions in <application>
?
推荐答案
引用的文档:
此属性设置适用于所有应用程序的组件的许可的便捷方式。
This attribute is a convenient way to set a permission that applies to all of the application's components
所以,如果每个&LT;活性GT;
,&LT;服务&GT;
,&LT ;供应商&GT;
和&lt;接收&GT;
在您的清单中也有同样的安卓权限
属性,可以消除冗余,只需在属性&lt;应用方式&gt;
So, if every <activity>
, <service>
, <provider>
, and <receiver>
in your manifest would have the same android:permission
attribute, you could eliminate the redundancy and simply have the attribute in <application>
.
在实践中,我怀疑这是几乎从来没有使用,除了也许通过签名
-level插件的权限仅限于与某些主机应用程序运行的应用程序。
In practice, I suspect that this is almost never used, except perhaps by plugin apps restricted to work only with some host app via a signature
-level permission.
这篇关于机器人:允许上述&lt;用途&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!