svenvdz
svenvdz

Reputation: 623

Android java set app permissions dynamically

Is it possible to set android app permission dynamically in java, usually it is set in AndroidManifest.xml. But what I want to do is giving my users a choice of what permissions they want my app to give. thanks in advance!

Upvotes: 2

Views: 1821

Answers (4)

Puneet Kumar
Puneet Kumar

Reputation: 306

It would be against Android policy . The application has or not has the permissions for doing something . It can be a security problem if you can think of it. It is possible no issue but in mid of app if not get then chances of getting crash in your app...

Upvotes: 0

Lawrence Ching
Lawrence Ching

Reputation: 483

Nope. App's permissions are declared in AndroidManifest.xml, which is used to tell Android system what permissions are required. App installer will show all permissions to help user judge the app is good or bad.

Thing about that if an malicious app require nothing at install-time and require camera permission at run-time dynamically

Upvotes: 0

Karol Żygłowicz
Karol Żygłowicz

Reputation: 2452

At the moment it's not possible http://developer.android.com/guide/topics/security/permissions.html

Android has no mechanism for granting permissions dynamically (at run-time) because it complicates the user experience to the detriment of security.

Things may change in new android M release

Upvotes: 1

Bryan Herbst
Bryan Herbst

Reputation: 67189

No, it is not currently possible. Up through Android Lollipop, permissions must be explicitly requested in the app's manifest and must be collectively all granted or denied (not installing the app) by the user at install time.

Android M, however, is changing this. As of Android M, permissions will be granted at runtime instead of at install time, allowing you to give users more control over which permissions they allow your app to use.

See the Android M runtime permissions documentation for more detail.

Upvotes: 3

Related Questions