我在android中创建了一个自定义权限:
<permission
android:name="com.master.me.CUSTOM_PERMISSION_TEST"
android:description="@string/des_permission"
android:label="labelhere">
</permission>
我将如何在我的活动中强制执行此操作AndroidManifest.xml
file?
Use android:permission
属性到活动标签中。
像下面这样
<activity android:permission="com.master.me.CUSTOM_PERMISSION_TEST"
android:name=".YourActivity"
android:label="@string/activity_label" />
并且你需要添加uses-permission
当您的其他应用程序需要启动此活动时,您的自定义权限。
<uses-permission android:name="com.master.me.CUSTOM_PERMISSION_TEST"/>
深入介绍
Android 权限模型 https://www.owasp.org/images/c/ca/ASDC12-An_InDepth_Introduction_to_the_Android_Permissions_Modeland_How_to_Secure_MultiComponent_Applications.pdf是一篇了解 Android 权限的非常好的文章。和Android中如何使用自定义权限? https://stackoverflow.com/questions/8816623/how-to-use-custom-permissions-in-android也是一个非常好的SO线程。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)