I am trying to use NFC to send a URL from an Android app to a WP8 phone.
When beaming to an Android device, the URL is sent correctly. However, when beaming to WP8, IE loads a link to the Play Store instead of the one I want to send (e.g. "http://www.stackoverflow.com").
The Play Store link is: "https://play.google.com/store/apps/details?id=com.example.conductrnfc&feature=beam". Where "com.example.conductrnfc" is the package name in the project.
The code I used to generate the NFC message is given below. Is there something I'm doing wrong here that breaks compatibility with WP8?
NfcAdapter nfc = NfcAdapter.getDefaultAdapter(this);
nfc.setNdefPushMessageCallback(new NfcAdapter.CreateNdefMessageCallback() {
@Override
public NdefMessage createNdefMessage(NfcEvent event)
{
NdefRecord uriRecord = NdefRecord.createUri(urlString);
return new NdefMessage(new NdefRecord[] { uriRecord });
}
},
this);
Can you try this:
NfcAdapter nfc = NfcAdapter.getDefaultAdapter(this);
nfc.setNdefPushMessageCallback(new NfcAdapter.CreateNdefMessageCallback() {
@Override
public NdefMessage createNdefMessage(NfcEvent event)
{
byte[] payload = urlString.getBytes();
NdefRecord uriRecord = new NdefRecord(NdefRecord.TNF_WELL_KNOWN, NdefRecord.RTD_URI, new byte[0], payload);
return new NdefMessage(new NdefRecord[] { uriRecord });
}
},
this);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With