由网友(她会发光我会反光i)分享简介:我如何检查NFC是否已启用编程?有没有办法从我的程序在设备上启用NFC?请帮我解决方案 NfcManager经理=(NfcManager)context.getSystemService(Context.NFC_SERVICE);NfcAdapter适配器= manager.getDefaultAdapter(...
我如何检查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
解决方案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.
相关推荐
最新文章