Question

so, i have an NFC project, i use "text/x-vcard" and "text/plain" for text type and vcard type in my nfc writer.

on text type, the reader will read it and show the text on vcard type, the reader will read it and open contact application

private NdefMessage getNoteAsNdef() {
    byte[] textBytes = mNote.getText().toString().getBytes();
    NdefRecord textRecord = new NdefRecord(NdefRecord.TNF_MIME_MEDIA, "text/uri-list".getBytes(),
            new byte[] {}, textBytes);
    return new NdefMessage(new NdefRecord[] {
        textRecord
    });

i tried for url type, i'm using "text/uri-list" and when i read it using the reader, nothing happen and it won't jump to my phone browser

so what i supposed to do when anything like this happen?

Was it helpful?

Solution

Creating a NdefRecord with an URL which opens in the browser should work this way:

NdefRecord rtdUriRecord1 = NdefRecord.createUri("http://example.com");

References:

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top