Android M has introduced Runtime permission model.
checkPermission()
method of Package Manager can be used to know if a permission is granted to an application.
Is it also possible to get a callback in application, when user grants/revokes permission ?
So that a feature dependent on that permission can be enabled/disabled.
Is it also possible to get a callback in application, when user grants/revokes permission ?
If you are requesting permissions with requestPermission()
, your callback is onRequestPermissionResult()
.
If the user revokes permissions via Settings, your callback is onCreate()
, as Android will terminate your process.
If the user grants permissions via Settings, you do not find out about that, until your next call to checkSelfPermission()
. There is no callback for this scenario.