0

I am developing an app that does some admin operations on android devices.

The users of android devices running on marshmallow and later has the ability to disable or enable the permissions for a particular app, and I want to restrict the user from disabling my app's permissions since it is an admin app and it need the permissions to run the app.

Is there anyway to restrict enabling/disabling permissions particularly for apps with device administrator privileges?

Wasiq Muhammad
  • 3,080
  • 3
  • 16
  • 29
Raneez Ahmed
  • 3,808
  • 3
  • 35
  • 58

2 Answers2

1

You Cannot restrict a user from enabling and/or disabling permissions on devices above Marshmallow.

The Only thing you can do is just check if the user has disabled the permission then either explain him why your app needs the permissions and if he is still not giving permissions then don't let him enter the app.

You can check at start of app whether the user has disabled your permission using

 ContextCompat.checkSelfPermission(context, permission);

It will return -1 if the permission is not available.

Ashish Shukla
  • 1,027
  • 16
  • 36
-2

No, This is not under the legal standard of android, you have to check permission on your app at Splash or First Screen that your app has access that permission or not for move further.

Harsh Mittal
  • 449
  • 3
  • 10