.. _nfc_launch_app: Launch App ########## .. contents:: :local: :depth: 2 The Launch App library provides a way to create NFC messages capable of launching Android or iOS applications. Overview ******** A Launch App message contains two records: URI record and Android Launch App record. Typically, the URI record contains a Universal Link used by iOS and the Android record contains an Android package name. The Universal Link is a link associated to the application. Implementation ************** The :ref:`nfc_launchapp_rec` library provides functions for creating the record and the :ref:`nfc_launchapp_msg` library provides functions for creating and encoding the message. The following code snippets show how to generate a Launch App message. 1. Define the Universal Link string, Android package name string, and create a buffer for the message: .. code-block:: c /* Package: no.nordicsemi.android.nrftoolbox */ static const uint8_t android_pkg_name[] = { 'n', 'o', '.', 'n', 'o', 'r', 'd', 'i', 'c', 's', 'e', 'm', 'i', '.', 'a', 'n', 'd', 'r', 'o', 'i', 'd', '.', 'n', 'r', 'f', 't', 'o', 'o', 'l', 'b', 'o', 'x' }; /* URI nrf-toolbox://main/ */ static const uint8_t universal_link[] = { 'n', 'r', 'f', '-', 't', 'o', 'o', 'l', 'b', 'o', 'x', ':', '/', '/', 'm', 'a', 'i', 'n', '/'}; #. Create the Launch App message: .. code-block:: c int err; err = nfc_launchapp_msg_encode(android_pkg_name, sizeof(android_pkg_name), universal_link, sizeof(universal_link), ndef_msg_buf, &len); if (err < 0) { LOG_ERR("Cannot encode message!"); return err; } Provide the following parameters: * Android package name string * Length of Android package name string * Universal Link string * Length of the Universal Link string * Message buffer * Size of the available memory in the buffer Supported features ****************** The library supports encoding AAR (Android Application Record) and Universal Links into NFC message. Samples using the library ************************* You can use this library when building NDEF messages for tag emulation (for example, with the Type 2 or Type 4 Tag libraries). |BMshort| currently does not provide samples using this library. Dependencies ************ * :ref:`nfc_uri_msg` * :ref:`nfc_ndef_msg` * :ref:`nfc_ndef_record` API documentation ***************** .. _nfc_launchapp_msg: Launch App messages =================== | Header file: :file:`bm/nfc/ndef/launchapp_msg.h` | Source file: :file:`subsys/nfc/ndef/launchapp_msg.c` :ref:`NDEF Launch App messages API reference ` .. _nfc_launchapp_rec: Launch App records =================== | Header file: :file:`bm/nfc/ndef/launchapp_rec.h` | Source file: :file:`subsys/nfc/ndef/launchapp_rec.c` :ref:`NDEF Launch App records API reference `