Skip to content

Instantly share code, notes, and snippets.

@pjwelcome
Created September 3, 2017 07:57
Show Gist options
  • Save pjwelcome/7d165630f6422fe0ce5b5c36d42bbbfe to your computer and use it in GitHub Desktop.
Save pjwelcome/7d165630f6422fe0ce5b5c36d42bbbfe to your computer and use it in GitHub Desktop.
private fun getNDefMessages(intent: Intent): Array<NdefMessage> {
val rawMessage = intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES)
rawMessage?.let {
return rawMessage.map {
it as NdefMessage
}.toTypedArray()
}
// Unknown tag type
val empty = byteArrayOf()
val record = NdefRecord(NdefRecord.TNF_UNKNOWN, empty, empty, empty)
val msg = NdefMessage(arrayOf(record))
return arrayOf(msg)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment