I want to display to the user the ID of the public transit card (IsoDep, NfcB), what I managed to do successfully with the following guide.
Now I'm trying to emulate the card with Host Card Emulation with the following guide.
I made a new class named MyHosApduService.java
with the following code:
public class MyHostApduService extends HostApduService {
@Override
public byte[] processCommandApdu(byte[] apdu, Bundle extras) {
...
}
@Override
public void onDeactivated(int reason) {
...
}
}
Declared the service at the AndroidManifest.xml
with the following code:
<service android:name=".MyHostApduService" android:exported="true"
android:permission="android.permission.BIND_NFC_SERVICE">
<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"/>
</service>
And apduservice.xml
with the following code:
<?xml version="1.0" encoding="utf-8"?>
<host-apdu-service xmlns:android="http://schemas.android.com/apk/res/android"
android:description="@string/servicedesc"
android:requireDeviceUnlock="false">
<aid-group android:description="@string/aiddescription"
android:category="other">
<aid-filter android:name="0x00DDA611"/>
</aid-group>
</host-apdu-service>
From here, how do I send the correct data to the service and trigger the service correctly?