Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic.
Home › Forums › Ask the Flomies › set Application Record and MIME type
Tagged: Android Application Record, MIME type, NDEF, Swift, Writing tags
I am using Flomio to write the tag and reading with Flomio and also reading with iOS CoreNFC, however our Android app has more properties set on the tag apart from the ndefMessage itself.
In Android, we specify the MIME type andalso there is a method used: NdefRecord.createApplicationRecord on Android.
Is there a way with the pro SDK to write to a tag and also specify these properties?
Regards,
Roseanne
Hi Roseanne,
Yes it is possible. Here is an example to write MIME type records.
Application records are MIME types. You set the TYPE to be “application/com.yourapp.identifier”.
Let me know if you have any issues.
Scott
Hi Scott,
Would you have an example available in Swift?
Thanks,
Roseanne
Hi Roseanne,
Here is the example in Swift with an Android Application Record:
let type = "application/com.yourapp.id".data(using: .ascii)
let record = FmNdefRecord.init(tnf: Int16(kTNFMimeMedia), andType: type, andId: nil, andPayload: "Hello".data(using: .ascii))
let message = FmNdefMessage.init(ndefRecords: [record!])
tag.writeNdef(message) { (success) in
if (success) {
print("Tag written successfully")
}
}
Scott
You must be logged in to reply to this topic.