通过Android Studio中的DevicePolicyManager禁用NFC

发布于 2025-02-09 08:22:39 字数 282 浏览 2 评论 0 原文

我通过在Android 12中使用Samsung S20的摄像机通过

DevicePolicyManager.setCameraDisabled(ComponentName admin, boolean disabled). 

我想使用DevicePolicyManager中的策略禁用NFC的方法,但是我尚未找到禁用NFC的方法。有人知道是否存在一种方法?是否有另一种方法可以通过策略执行切换/禁用NFC?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

千仐 2025-02-16 08:22:39

显然,根据官方
有一些选项包括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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文