如何关闭/禁用NFC programmataically? [英] How to turn off/disable NFC programmataically?

查看:618
本文介绍了如何关闭/禁用NFC programmataically?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何编写编程关闭/禁用NFC当我关闭我的应用程序或应用程序时,我的应用程序处于空闲状态?

How to write an application that turn off/disable NFC programmatically when I close my application or when my application is idle?

推荐答案

如果你真的把NFC的电源,使用 NfcAdapter.disable();

If you really have to turn NFC off, use NfcAdapter.disable();.

但是,您将无法使用禁用() API,如果你的应用是不是系统的应用是与平台共同建立。

However, you won't be able to use disable() API if your app is not system application which is build together with the platform.

另外,你可能会显示一个通知(一个对话框?)给用户,并问她是否要关闭NFC。如果用户同意,可以使用下面的她重定向到全局设置UI 意图

Alternatively, you may show a notice (a dialog?) to the user and ask her if she wants to turn off the NFC. If user agrees, you can redirect her to global Settings UI using following Intent:

startActivity(new Intent("android.settings.NFC_SETTINGS"));

这篇关于如何关闭/禁用NFC programmataically?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆