I am working on a project that requires me to simulate an NFC tag detection event. I am able to successfully trigger the event with a mock tag using reflection. My issue is, the mock tag is not usable with any TagTechnology object. What I need is to instance an NFC tag that I can connect to and disconnect from at will.
Ideally it would make the NFC service believe an NFC tag is adjacent to the phone even when one is not there and thus the NFC antenna would maintain a higher power state until I disconnect the simulated tag.
I'm guessing I need to use reflection with the Tag's constructor:
public Tag(byte[] id, int[] techList, Bundle[] techListExtras, int serviceHandle,
INfcTag tagService) {}
It is the last two arguments that I am struggling with since the first four are covered by the mocktag.
EDIT:
The basic idea behind this is to control the state of the NFC adapter between active and passive state and thus exerting some control over the power output of the NFC antenna.