Created
September 3, 2017 07:58
-
-
Save pjwelcome/1aed3dd849d892abf718b6d17287d6fe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun retrieveNFCMessage(intent: Intent?): String { | |
intent?.let { | |
if (NfcAdapter.ACTION_NDEF_DISCOVERED == intent.action) { | |
val nDefMessages = getNDefMessages(intent) | |
nDefMessages[0].records?.let { | |
it.forEach { | |
it?.payload.let { | |
it?.let { | |
return String(it) | |
} | |
} | |
} | |
} | |
} else { | |
return "Touch NFC tag to read data" | |
} | |
} | |
return "Touch NFC tag to read data" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment