I use a HostApduService
on Android(7) to emulate an NFC forum type 4 (NDEF
) tag.
Reading the NDEF
text message works reliably from android, I ran into the following issues though:
- When I scan the emulating phone with NXP TagInfo from another Android device, Google Play opens up since it is also listening, but the
NDEF
tag always gets scanned successfully. - Reading the Tag using NXP TagInfo on an iPhone(7) as a reader is different: The core
NFC
API looks very limited, and scanning has to be initiated by the user, accompanied by a "ready to scan" dialog. When I hold the iPhone to the Android Device, sometimes the dialog closes with the message "NFC
session expired" (about 50% of the tries). When I lock the emulating Android phone, theNDEF
service still runs, and the iPhone can scan the Tag with a 100% success rate.
I think I already fixed the first issue using ForegroundDispatch
(the Tag Emulation is only needed when the Emulating app is shown on the screen). However, the iPhone still cancels scanning sometimes. I suppose this could also be caused by the Android phone trying to connect to the iPhone's HCE/ApplePay/whatever is there.
So I believe the cause of my problem is Android scanning for all kinds of tags while NFC
is enabled.
Is there a way to disable actively scanning for passive tags from an app, while still running the HostApduService
that emulates an NFC
tag?
(I will update this question as soon as I get the core NFC
error messages.)