11

Is there any way for permission state change detection in Android Marshmallow?

I have not seen broadcast for that...

ArtKorchagin
  • 4,801
  • 13
  • 42
  • 58
itzhar
  • 12,743
  • 6
  • 56
  • 63

3 Answers3

1

Permissions cannot change in the middle of the app. If an permission is changed -> the app is restarted. There is no Broadcast - you have to check every-time - but it is OK to only do it at startup of your app

ligi
  • 39,001
  • 44
  • 144
  • 244
  • 3
    No, it's NOT good to check on startup only. If you **request** permissions and not simply check them, you shouldn't do it for all the permissions at once (this is against Google's guideline). But even if you check only, the user may any time **give** you a permission via Settings – igorepst Dec 16 '15 at 12:42
  • App is not restarting in my but just start from last activity which in in background! i want to restart the app when user change any permissions? any help? – Sohail Zahid May 02 '18 at 10:53
1

No. You will not get any broadcast for it. On each call of a feature, which needs permission, you need to check if permission is granted or not.


Read Request App Permissions, a well documented, and covers each point which you need to take care of. It seems Google has achieved the official sample, but still, you can find some useful information from the sample. And at last watch Android Marshmallow 6.0: Asking For Permission to design your app in a better way.


Note:

Also read, Permissions updates in Android 11,

Pankaj Kumar
  • 81,967
  • 29
  • 167
  • 186
0

You have to check permission each and every time whenever you use. For your simplicity you can use PermissionAcceptor-master library.

Harsh Patel
  • 657
  • 11
  • 26