NFC: Launch App

The NFC Launch App sample shows how to use the NFC tag to launch an app on the polling smartphone. It uses the NFC Data Exchange Format (NDEF) library.

Requirements

This sample supports the following development kits:

Hardware platforms

PCA

Board name

Build target

nRF5340 DK

PCA10095

nrf5340dk_nrf5340

nrf5340dk_nrf5340_cpuapp

nrf5340dk_nrf5340_cpuapp_ns

nRF52840 DK

PCA10056

nrf52840dk_nrf52840

nrf52840dk_nrf52840

nRF52 DK

PCA10040

nrf52dk_nrf52832

nrf52dk_nrf52832

nRF52833 DK

PCA10100

nrf52833dk_nrf52833

nrf52833dk_nrf52833

The sample also requires a smartphone or a tablet. You need to have the nRF Toolbox app installed for iOS devices.

Overview

When the sample starts, it initializes the NFC tag and generates an NDEF message with two records that contain the app Universal Link and Android Application Record. Then it sets up the NFC library to use the generated message and sense the external NFC field.

The only events handled by the application are the NFC events.

User interface

LED 1:

Indicates if an NFC field is present.

Building and running

This sample can be found under samples/nfc/record_launch_app in the nRF Connect SDK folder structure.

See Building and programming an application for information about how to build and program the application.

Testing

After programming the sample to your development kit, perform the following steps to test it:

  1. Touch the NFC antenna with the smartphone or tablet and observe that LED 1 is lit.

  2. Observe that the smartphone or tablet launches the nRF Toolbox application.

  3. Move the smartphone or tablet away from the NFC antenna and observe that LED 1 turns off.

    Note

    Devices running iOS require the nRF Toolbox app to be installed before testing the sample. Devices running Android will open Google Play when the application is not installed.

Dependencies

This sample uses the following nRF Connect SDK libraries:

In addition, it uses the Type 2 Tag library from sdk-nrfxlib:

Type 2 Tag

The sample uses the following Zephyr libraries:

  • include/zephyr.h

  • include/power/reboot.h