Can Android apps request additinal permissions at

2019-03-23 07:39发布

问题:

I'm working on an app which contains some scripting support. The scripts executed by this app might require all sorts of permissions in the future, but it's difficult to predict which ones.

Is there a way to request additional permissions at runtime (like iPhone apps sometimes do) instead of specifying them all in advance in AndroidManifest.xml?

回答1:

According to the Android documentation:

The permissions required by an application are declared statically in that application, so they can be known up-front at install time and will not change after that.



回答2:

The Android M introduces a new app permissions model which streamlines the process for users to install and upgrade apps. If an app running on the M supports the new permissions model, the user does not have to grant any permissions when they install or upgrade the app. Instead, the app requests permissions as it needs them, and the system shows a dialog to the user asking for the permission.

User Grants Permissions at Run-Time: When the app requests a permission, the system shows a dialog to the user, then calls the app's callback function to notify it whether the permission was granted. If a user grants a permission, the app is given all permissions in that permission's functional area that were declared in the app manifest.

For more information check this link.