Android Question NFCTagWriter

dibesw

Active Member
Licensed User
Longtime User
I want write plus record (type text) in a TAG
I found this to work well
B4X:
Sub createTextNDEF(Text As String) As RSNFCRecord

    Dim lang As String = "en"
    Dim textBytes() As Byte = Text.GetBytes("UTF8")
    Dim langBytes() As Byte = lang.GetBytes("US-ASCII")
    Dim langLength As Int = langBytes.Length
    Dim textLength As Int = textBytes.Length
    
    Dim payload(1 + langLength + textLength) As Byte
    payload(0) = langLength
    
    NFCTagWriter.ArrayCopy(langBytes, 0, payload, 1, langLength)
    NFCTagWriter.ArrayCopy(textBytes, 0, payload, 1 + langLength, textLength)

    Dim recordNFC As RSNFCRecord
    Dim b(0) As Byte
    recordNFC.Initialize(recordNFC.TNF_WELL_KNOWN, recordNFC.RTD_TEXT, b, payload)
    Return recordNFC

End Sub

Can someone give me an example to write more records?
 
Top