I disabled the camera of a Samsung S20 in android 12 through the method
DevicePolicyManager.setCameraDisabled(ComponentName admin, boolean disabled).
I want to disable NFC using policies found in DevicePolicyManager, but i have yet to find a method for disabling NFC. Does anyone know if there even exists a method to do this? Is there another way to enforce a toggle/disable NFC through policies?
CodePudding user response:
Apparantly there is no straightforward way to disable NFC by means of DevicePolicies according to the official documentation. There are some options that include the term NFC but it seems it's mostly related to provisioning.
Most answers or documentation suggests to disable NFC by accessing the Adapter programmatically (see linked answer;which is not what you asked for). In addition, most answers emphasize that the approach is not applicable to "normal" devies. It requires root access to disable the adapter. That may be a limiting for you as well.
For what it's worth, a custom device policy could be a promising lead. I'd advise to research that option. Alternatively, if you can you could inform the user that NFC has to be turned off upon App start and quit otherwise.