动态获取Android权限
我想知道是否可以在不使用 AndroidManifest 的情况下动态获取 Android 权限,仅使用一些代码,因为我有一些 OSGi 包在 Android 上运行,如果没有 Android 权限,它们的功能会受到限制。
感谢您的回答,是的,它会使用户体验变得复杂,并且如果提供该机制对用户来说也是危险的
I'm wondering if it's possible to get Android permission dynamically without using AndroidManifest just with some codes, because I've some OSGi bundles running on Android and without Android permission they are restricted in functionality.
Thanks for your answers, yes it complicates the user experience and it's also dangerous for the user if that mechanism is provided
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
不,这是不可能的。
您无法更改已安装的 APK 的内容。无论如何,允许这种行为都是非常危险的,因为整个权限系统旨在允许用户首先读取应用程序需要哪些权限,以便他可以判断它是否可以。
No this is not possible.
You can't alter the contents of an already installed APK. It would be very dangerous to allow such a behavior anyway as the whole permissions system is meant to allow the user to first read what permissions an Application requires so he can judge if it is ok or not.
不,抱歉,您必须通过
AndroidManifest.xml
文件请求所有权限。No, sorry, you must request all permissions via the
AndroidManifest.xml
file.是的,我在 http://developer.android.com/guide/ 中找到了这一行topic/security/security.html:
Android 没有动态授予权限(在运行时)的机制,因为它使用户体验复杂化,从而损害安全性。
Yes, i found this line in http://developer.android.com/guide/topics/security/security.html:
Android has no mechanism for granting permissions dynamically (at run-time) because it complicates the user experience to the detriment of security.
现在从Android 6.0 Marshmellow开始,您可以要求用户在运行时动态允许权限,我发现了,看看此链接。我希望它能帮助您获得想法。
Guys now from Android 6.0 Marshmellow onward, you can ask users at runtime to allow permissions dynamically, I found of it, have a look at this link. I hope it will help you getting idea.