如何检查NFC是否已启用的机器人?机器人、NFC

2023-09-05 00:31:41 作者:她会发光我会反光i

我如何检查NFC是否已启用编程?有没有办法从我的程序在设备上启用NFC?请帮我

解决方案

  NfcManager经理=(NfcManager)context.getSystemService(Context.NFC_SERVICE);
NfcAdapter适配器= manager.getDefaultAdapter();
如果(适配器= NULL和放大器;!&安培; adapter.isEnabled()){
    //适配器存在且已启用。
}
 

您不能启用NFC编程。用户必须通过设置或硬件按钮手动完成。

How can i check whether NFC is enabled or not programmatically? Is there any way to enable the NFC on the device from my program? Please help me

解决方案 NFC卡片 语音交互,KOMO是一款给孩子的教育机器人

NfcManager manager = (NfcManager) context.getSystemService(Context.NFC_SERVICE);
NfcAdapter adapter = manager.getDefaultAdapter();
if (adapter != null && adapter.isEnabled()) {
    // adapter exists and is enabled.
}

You cannot enable the NFC programmatically. The user has to do it manually through settings or hardware button.