導(dǎo)入模塊
import cardEmulation from '@ohos.nfc.cardEmulation';
FeatureType
定義不同的NFC卡模擬類型。
NOTE
從 API version 6 開始支持,從 API version 9 開始廢棄,建議使用hasHceCapability替代。
系統(tǒng)能力: SystemCapability.Communication.NFC.CardEmulation
CardType9+
定義卡模擬應(yīng)用所使用的業(yè)務(wù)類型,是支付類型,還是其他類型。
系統(tǒng)能力: SystemCapability.Communication.NFC.CardEmulation
isSupported
isSupported(feature: number): boolean
是否支持某種類型的卡模擬。
NOTE
從 API version 6 開始支持,從 API version 9 開始廢棄,建議使用hasHceCapability替代。
系統(tǒng)能力: SystemCapability.Communication.NFC.CardEmulation
返回值:
hasHceCapability9+
hasHceCapability(): boolean
判斷是否支持HCE功能。
系統(tǒng)能力: SystemCapability.Communication.NFC.CardEmulation
需要權(quán)限: ohos.permission.NFC_CARD_EMULATION
返回值:
isDefaultService9+
isDefaultService(elementName: ElementName, type: CardType): boolean
判斷指定的應(yīng)用是否為指定業(yè)務(wù)類型的默認應(yīng)用。
系統(tǒng)能力: SystemCapability.Communication.NFC.CardEmulation
需要權(quán)限: ohos.permission.NFC_CARD_EMULATION
參數(shù):
返回值:
示例:
import cardEmulation from '@ohos.nfc.cardEmulation'; var isHceSupported = cardEmulation.isSupported(cardEmulation.FeatureType.HCE); if (!isHceSupported) { console.log('this device is not supported for HCE, ignore it.'); return; } var hasHceCap = cardEmulation.hasHceCapability(); if (!hasHceCap) { console.log('this device hasHceCapability false, ignore it.'); return; } var elementName = { "bundleName": "com.test.cardemulation", "abilityName": "com.test.cardemulation.MainAbility", }; var isDefaultService = cardEmulation.isDefaultService(elementName, cardEmulation.CardType.PAYMENT); console.log('is the app is default service for this card type: ' + isDefaultService); 審核編輯 黃宇
-
nfc
+關(guān)注
關(guān)注
59文章
1633瀏覽量
180993 -
鴻蒙
+關(guān)注
關(guān)注
57文章
2393瀏覽量
43084
發(fā)布評論請先 登錄
相關(guān)推薦
![](https://file1.elecfans.com/web2/M00/8E/8E/wKgZomTIYyKAAT_1AAArgRY3CJw110.png)
![](https://file1.elecfans.com/web3/M00/06/59/wKgZPGeJ7v-ARlxMAARK60PqDsI474.png)
![](https://file1.elecfans.com/web3/M00/02/A0/wKgZPGdhNSmAaEf_AABJ2161gtk593.png)
![](https://file1.elecfans.com/web2/M00/8E/8E/wKgZomTIYyKAAT_1AAArgRY3CJw110.png)
![](https://file1.elecfans.com/web2/M00/09/6E/wKgZomcM0WKAXziQAAOrbYhT9IM105.png)
NFC硅膠腕帶網(wǎng)址讀寫應(yīng)用演示 #nfc #NFC標簽 #手環(huán)手表 #智能手環(huán) #硅膠腕帶
![](https://file1.elecfans.com/web2/M00/8E/8E/wKgZomTIYyKAAT_1AAArgRY3CJw110.png)
![](https://file1.elecfans.com/web2/M00/08/65/wKgaombxLnOAVNp5AATeQDpg1r4136.png)
![](https://file1.elecfans.com/web2/M00/06/32/wKgZombirZqAMT39AAQw5mYnADI538.png)
NFC IC配置工具NFC Cockpit的主要特性
![<b class='flag-5'>NFC</b> IC配置工具<b class='flag-5'>NFC</b> Cockpit的主要特性](https://file1.elecfans.com/web2/M00/04/49/wKgZombNNr6AIpU4AAKEVf6il1E492.jpg)
![](https://file1.elecfans.com/web2/M00/8E/8E/wKgZomTIYyKAAT_1AAArgRY3CJw110.png)
消費類電子標簽NFC手環(huán)標簽 #NFC標簽 #nfc手環(huán) #硅膠手環(huán)標簽 #nfc
![](https://file1.elecfans.com/web2/M00/8E/8E/wKgZomTIYyKAAT_1AAArgRY3CJw110.png)
![](https://file1.elecfans.com/web2/M00/8E/8E/wKgZomTIYyKAAT_1AAArgRY3CJw110.png)
![](https://file1.elecfans.com/web2/M00/E5/EA/wKgaomZBvbyAJeY6AAoJGQ3Ns8Q987.jpg)
評論