get Android permission dynamically

旧巷老猫 提交于 2020-01-10 03:03:18

问题


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


回答1:


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.




回答2:


No, sorry, you must request all permissions via the AndroidManifest.xml file.




回答3:


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.




回答4:


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.



来源:https://stackoverflow.com/questions/4838779/get-android-permission-dynamically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!