通过Android Studio中的DevicePolicyManager禁用NFC
我通过在Android 12中使用Samsung S20的摄像机通过
DevicePolicyManager.setCameraDisabled(ComponentName admin, boolean disabled).
我想使用DevicePolicyManager中的策略禁用NFC的方法,但是我尚未找到禁用NFC的方法。有人知道是否存在一种方法?是否有另一种方法可以通过策略执行切换/禁用NFC?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
显然,根据官方。
有一些选项包括NFC一词,但似乎与配置主要有关。
大多数答案或文档建议通过以编程方式访问适配器来禁用NFC(请参阅链接答案;这不是您要求的)。
此外,大多数答案都强调该方法不适用于“正常”的转变。它需要词根访问以禁用适配器。这也可能是您的限制。
对于它的价值,a 自定义设备策略可能是一个有希望的领导者。我建议研究该选项。
另外,如果可以的话,您可以通知用户在应用程序开始时必须关闭NFC,否则必须辞职。
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.