This document aims at presenting the objects and methods available in the mobile SDK to manage content from the Adtag Platform

Pre-requisites

Prior to going through this tutorial, please make sure that:

  • You have access to the Adtag Platform
  • You have installed our tutorial application on your smartphone to perform live tests with the illustrative code that follows
  • You have completed the Adtag Overview tutorial

Accessing Adtag content from the mobile SDK

Our SDK allows developers to access Adtag content through two objects adtagContent and beaconContent and specific methods.

  • AdtagContent: this object has generic methods to retrieve information for any point & technology (NFC tags / QRC / beacons).
  • BeaconContent: BeaconContent extends AdtagContent and has specific, build-in methods to retrieve beacon information more easily.

These methods allow developers to retrieve information from the following beacon-specific Adtag categories (Beacon Content tab): - beacon-notification, which includes the content of beacon notifications - beacon-alert, which includes the content of beacon alerts - beacon-alert-parameter, which includes the conditions an alert must fulfill to be displayed.

Accessing the content of a category using the AdtagContent object

The AdtagContent object has several methods to access the fields of a category, depending on their type. These methods can also be used with the BeaconContent object.

Accessing a String field

Android

AdtagContent.getValue(CATEGORY_NAME, FIELD_NAME)

For example:

adtagContent.getValue("beacon-notification", "title")

allows to retrieve the field title from the category beacon-notification.

iOs

Switch to Swift

[AdtagContent getValueFromCategory:CATEGORY_NAME andField:FIELD_NAME]
adtagContent.getValueFromCategory(CATEGORY_NAME, andField: FIELD_NAME)

For example:

Switch to Swift

[AdtagContent getValueFromCategory:@"beacon-notification" andField:@"title"]
adtagContent.getValueFromCategory("beacon-notification", andField: "title")

allows to retrieve the field title from the category beacon-notification.

Accessing a Multimedia field

Android

AdtagContent.getMultimedia(CATEGORY_NAME, FIELD_NAME)

allows to retrieve the URL to download or read multimedia content (images, videos, audio files) from the Adtag Platform.

iOs

Switch to Swift

[AdtagContent getMultimediaFromCategory:CATEGORY_NAME andField:FIELD_NAME]
adtagContent.getMultimediaFromCategory(CATEGORY_NAME, andField: FIELD_NAME)

allows to retrieve the URL to download or read multimedia content (images, videos, audio files) from the Adtag Platform.

Accessing a Boolean field

Android

AdtagContent.getBoolean(CATEGORY_NAME, FIELD_NAME)

allows to retrieve a boolean for a FIELD_NAME and CATEGORY_NAME.

iOs

Switch to Swift

[AdtagContent getBooleanFromCategory:CATEGORY_NAME andField:FIELD_NAME]
adtagContent.getBooleanFromCategory(CATEGORY_NAME, andField:FIELD_NAME)

allows to retrieve a boolean for a FIELD_NAME and CATEGORY_NAME.

Test if a field is empty

Android

AdtagContent.isEmpty(CATEGORY_NAME, FIELD_NAME)

retrieves "true" if the FIELD_NAME for the CATEGORY_NAME is empty.

iOs

Switch to Swift

[AdtagContent isEmptyFromCategory:CATEGORY_NAME andField:FIELD_NAME]
adtagContent.isEmptyFromCategory(CATEGORY_NAME, andField:FIELD_NAME)

retrieves "true" if the FIELD_NAME for the CATEGORY_NAME is empty.

Accessing the beacon content fields

The BeaconContent object has a set of methods to easily access the beacon categories defined in the Adtag Beacon Content tab.

Accessing the Notification content

Reminder: The ADTAG fields to configure a notification are as follows:

  • Title: title of the notification
  • Description: description of the notification
  • TextToSpeech: if the SDK is configured to work with Text to Speech, this field is used as the default text for Text To Speech.
  • Thumbnail: thumbnail associated to the notification on Android 6+ device
  • Image: image associated to the notification (compatible with Android 6+ and iOs 10+)

For each of these fields, two BeaconContent object methods are available:

  • a getter method applying the following naming convention: getNotificationField, where Field is one of the Adtag notification fields (Title, Description etc...). For example, to get the notification title, you can use the getNotificationTitle method.

Android

AdtagContent.getNotificiationTitle()

iOs

Switch to Swift

[AdtagContent getNotificiationTitle]
adtagContent.getNotificiationTitle()
  • an isEmpty method, to test if a field is empty, and which applies the following naming convention: isNotificationFieldEmpty, where Field is one of the Adtag notification fields. For example, to test if “ text to speech” is empty, you can use the isNotificationTextToSpeechEmpty method.

Android

AdtagContent.isNotificationTextToSpeechEmpty()

iOs

Switch to Swift

[AdtagContent isNotificationTextToSpeechEmpty]
adTagContent.isNotificationTextToSpeechEmpty()

Accessing the Alert content

Reminder: The ADTAG fields to configure an alert are as follows:

  • Title: The title of the alert
  • Description: the description of the alert
  • TextToSpeech: if the SDK is configured to work with Text to Speech, this field is used as the default text for Text To Speech.
  • Thumbnail: a thumbnail associated to the alert

For each of these fields, two BeaconContent object methods are available:

  • a getter method applying the following naming convention: getAlertField, where Field is one of the Adtag alert fields (Title, Description etc...). For example, to get the alert thumbnail url, you can use the getAlertThumbnail method.

Android

AdtagContent.getAlertThumbnail()

iOs

Switch to Swift

[AdtagContent getAlertThumbnail]
adTagContent.getAlertThumbnail()
  • an isEmpty method, to test if a field is empty, and which applies the following naming convention: isAlertFieldEmpty, where Field is one of the Adtag alert fields. For example, to test if the Description field of an alert is empty, you can use the isAlertDescriptionEmpty method.

Android

AdtagContent.isAlertDescriptionEmpty()

iOs

Switch to Swift

[AdtagContent isAlertDescriptionEmpty]
adTagContent.isAlertDescriptionEmpty()