鸿蒙HarmonyOS NFC开发指南获取NFC信息

MoMo 2021年5月23日15:05:14
评论
573

 

1. 调用 NfcController 类的 getInstance()接口,获取 NfcController 实例。

2. 调用 CardEmulation 类的 getInstance(mNfcController)接口,获取CardEmulation 实例,去管理本机卡模拟模块操作。xpanx.com

3. 调用 getNfcInfo()接口去获取 NFC 信息。
// 获取 NFC 控制对象
NfcController mNfcController = NfcController.getInstance(context);
// 获取卡模拟控制对象
CardEmulation mCardEmulation =
CardEmulation.getInstance(mNfcController);
// 查询本机当前使能的安全单元类型 String seType =
mCardEmulation.getNfcInfo(CardEmulation.KEY_ENABLED_SE_TYPE); //
ENABLED_SE_TYPE_ESE
// 查询 Hisee 上电状态
String hiseeState =
mCardEmulation.getNfcInfo(CardEmulation.KEY_HISEE_READY);
// 查询是否支持 rssi 的查询
String rssiAbility =
mCardEmulation.getNfcInfo(CardEmulation.KEY_RSSI_SUPPORTED);

xpanx.com

https://xpanx.com/
MoMo
  • 本文由 发表于 2021年5月23日15:05:14
  • 转载请务必保留本文链接:https://xpanx.com/116.html
匿名

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: