*** CONFIGURAZIONE MANIFEST B4A ***
(Copia questo nel Manifest Editor di B4A)

AddPermission(android.permission.NFC)
AddFeature(android.hardware.nfc.hce)

AddServiceText(HceManager.HceService,
<intent-filter>
    <action android:name="android.nfc.cardemulation.action.HOST_APDU_SERVICE"/>
</intent-filter>
<meta-data android:name="android.nfc.cardemulation.host_apdu_service"
    android:resource="@xml/apduservice"/>)

CreateResource(xml, apduservice.xml,
<host-apdu-service xmlns:android="http://android.com"
    android:description="B4A HCE Emulator"
    android:requireDeviceUnlock="false">
    <aid-group android:description="NFC Forum Type 4" android:category="other">
        <aid-filter android:name="D2760000850101"/>
    </aid-group>
</host-apdu-service>)

*** CODICE ESEMPIO B4A ***

Sub Process_Globals
    Private nfc As HceManager
End Sub

Sub Activity_Create(FirstTime As Boolean)
    If FirstTime Then
        nfc.Initialize(Me, "nfc")
    End If
    nfc.SetTagText("Mio Messaggio NFC")
End Sub

Sub nfc_OnReaderConnected
    Log("Un lettore NFC ha toccato il telefono!")
End Sub

Sub nfc_OnMessageReceived(Status As String)
    Log("Stato: " & Status)
End Sub
