Can I still use Device Admin API only to disable the CAMERA for android 11 and above as Device Admin API is deprecated

352 Views Asked by At

In my project I’m using Device Admin API for disabling the CAMERA. It is working fine in Android 7 and 8. Can I still use Device Admin API only to disable the CAMERA for android 11 and above as Device Admin API is deprecated.

It is working fine in Android 7 and 8. Will it work for Android 10, 11 and above.

2

There are 2 best solutions below

0
Ahsan Zia On

It seems like Disable camera will not work for devices after Android 10.0. It is stated in google docs that it will throw a security exception. Check this link for reference.

https://developers.google.com/android/work/device-admin-deprecation#deprecated_policies

0
Solomon Ucko On

https://developers.google.com/android/work/device-admin-deprecation says:

Starting with the release of Android 10.0, the above-mentioned policies will throw a SecurityException when invoked by a device admin on apps targeting API level 29.

So you might be able to make it continue to work by setting your API level to 28 or less.

Related: How to disable camera in android 12 AOSP?, Android: Enable/Disable Camera programmatically, how to disable camera function in android programatically