I have an application that uses NFC. I want to limit the NFC interactions to other devices that are on the same activity of my application.
Problem
At the moment if I use a device A that has Chrome opened and my device B running my application, then Chrome will still detect the data sent by my app over NFC.
How can I say "if you are not running my application then you can't NFC interact with me"?
@Override
public NdefMessage createNdefMessage(NfcEvent event)
{
String stringOut = getMacAddress(this);
byte[] bytesOut = stringOut.getBytes();
NdefRecord ndefRecordOut = new NdefRecord(NdefRecord.TNF_MIME_MEDIA, "text/plain".getBytes(), new byte[] {}, bytesOut);
NdefMessage ndefMessageOut = new NdefMessage(ndefRecordOut);
return ndefMessageOut;
}
In the code above I am sending the NFC message regardless of what activity the other device has. Maybe there is a way to wait for a reply?