Near Field Communication (or NFC) is a reasonably modern technology that allows mobile devices to interact with terminals, swipe cards and fobs.

Android and iOS 11 have support to give access to turn the phone into an NFC reader. With this detail you can send that data back to Sailthru Mobile as Custom Attributes, and use these for audiences and automation.


CoreNFC was released in iOS 11 and Xcode 9. In the callback of the CoreNFC class, decode the payload and send relevant data to Carnival. Note: Only NDEF formatted cards and devices can be read.

@available(iOS 11.0, *)
func readerSession(_ session: NFCNDEFReaderSession, didDetectNDEFs messages: [NFCNDEFMessage]) {
    for message in messages {
        for record in message.records {
            let optIdentifier = String(bytes: record.identifier, encoding: .utf8)

            if let identifier = optIdentifier {
                let attrs = CarnivalAttributes()
                attrs.setString(identifier, forKey: "NFC_ID")
                Carnival.setAttributes(attrs, withResponse: nil)


On Android, the NFC library will fire an intent where you'll be able to decode the payload. Similar to iOS, you should send the data to Sailthru Mobile from there.

// From the NFC Basics doc.
protected void onNewIntent(Intent intent) {
    if (intent != null && NfcAdapter.ACTION_NDEF_DISCOVERED.equals(intent.getAction())) {
        Parcelable[] rawMessages =
        if (rawMessages != null) {
            NdefMessage[] messages = new NdefMessage[rawMessages.length];
            for (int i = 0; i < rawMessages.length; i++) {
                messages[i] = (NdefMessage) rawMessages[i];
            // Process the messages array.
            // Send to Carnival.

Further Reading