write multiple information in nfc tag

// Expert user has replied.
M Mauro Soro 3 years 7 months ago
80 1 0

Hi all,

I would try to write in an nfc tag with Rhodes nfc api a multiple message (code for open an application and a simple string).
Following the rhomobile doc I am able to detect the tag and write a simple string but I'm not able to write a composed tag.
I am using a Topaz 512 tag and I have the bytes space to write this information (tested with simple app from play store).

The code I try to use is the following

payload = Rho::NFCManager.make_payload_with_well_known_text("en", "TEST")
    hash = {
      'id' => [0],
      'type' => Rho::NdefRecord:: RTD_TEXT,
      'tnf' => Rho::NdefRecord::TNF_WELL_KNOWN,
      'payload' => payload
    }
  
  
  payload = Rho::NFCManager.make_payload_with_absolute_uri('com.packagename.appname')
  hash1 = {
  'id' => [1],
  'tnf' => Rho::NdefRecord::TNF_EXTERNAL_TYPE,
  'payload' => payload
}
    record = []
      record[0] = Rho::NFCManager.make_NdefRecord_from_hash(hash)
      record[1] = Rho::NFCManager.make_NdefRecord_from_hash(hash1)
  
  
msg = Rho::NFCManager.make_NdefMessage_from_array_of_NdefRecord(record)

I have added in the AndroidManifest.xml the following line

 
 
 

and in the filter_nfc there is this line

   
   
        android.nfc.tech.MifareClassic
        android.nfc.tech.Ndef
   

But when I execute the test app it crashes. Can anyone explain me where is the error and how can I solve it?

Thanks, best regards,
Mauro

Please Register or Login to post a reply

1 Replies

R Robert Galvin

Do you have the logs from the error? I do not have such a tag to test it with, but maybe something in the error log will be helpful.

CONTACT
Can’t find what you’re looking for?