How to write an AAR in my Android Application?

406 views Asked by At

I'm trying to write a simple AAR into my Android application. My code follows:

        NdefMessage ndefMessage = createNdefMessage("1");
        writeNdefMessage(tag,ndefMessage);
        NdefRecord.createApplicationRecord("com.example.myapp");

When I build the application, my NdefMessage of "1" shows up without any problem...but my AAR isn't working? I'm doing something stupid and I need another set of eyes...I appreciate any help, thanks!!!

1

There are 1 answers

4
corvairjo On

You create a NdefMessage containing only one record. Assuming that you want to write the "1" as a text string, you might code it like:

NdefRecord[] ndefRecords;
ndefRecords[0] = NdefRecord.createTextRecord ("en", "1");
ndefRecords[1] = NdefRecord.createApplicationRecord("com.example.myapp");
NdefMessage ndefMessage = new NdefMessage(ndefRecords);
writeNdefMessage(tag, ndefMessage);