Is it possible to change the android attribute <host-apdu-service> android: requireDeviceUnlock at run time?
The Android NFC HCE HostApduService is configured through apduservice.xml, which contains:
<host-apdu-service xmlns:android="http://schemas.android.com/apk/res/android"
android:description="@string/servicedesc"
android:requireDeviceUnlock="true" >
<aid-group
android:category="other"
android:description="@string/aiddescription" >
<aid-filter android:name="F0010203040506" />
</aid-group>
</host-apdu-service>
I want to make requireDeviceUnlock a user-configurable parameter at runtime. I suspect that I can forcefully reload the XML file by restarting the service with:
stopService(new Intent(this, MyHostApduService.class));
startService(new Intent(this, MyHostApduService.class));
But how to change the parameter in the XML file at runtime?
+4
1 answer
I really looked at the implementation of the same functionality, i.e. for this, user preference required unlocking the device or not.
However, looking at the api
https://developer.android.com/reference/android/nfc/cardemulation/HostApduService.html
, , "requireDeviceUnlock", apduservice.xml .
, .
false, apduservice sharedpreference, , , / .
+2