Please enable JavaScript to view this site.

Altova MobileTogether Designer

The NFC Push action (screenshot below) defines the message to push or the file to beam. When the action is triggered, the specified message or file is transmitted via NFC. In order for the Push action to work, the NFC Start action must be triggered already—so that the device is ready for the Push action. Once an NFC Push action has been started, the NFC message or file can be sent multiple times (that is, to different devices). All that the end user needs to do is to place the receiving device within NFC range of the sending device. This continuous sending is stopped when NFC is stopped, or when an NFC Push is canceled (which is done by adding a new NFC Push action with the Cancel option selected; see screenshot below).

MTActionNFCPush01

The NFC Push action provides the following options (see screenshot):

 

NFC Push: to push a message

Android Beam: to beam a file from one Android-Beam-enabled device to another Android-Beam-enabled device (available for Android devices only)

 

Select the radio button of the type of Push action you want to carry out (see descriptions below).

 

Note:Each action corresponds to one message/file to be transmitted. Note, however, that a message can consist of multiple records. For example, the message in the screenshot above contains three records. If you want to send more than one message, then add a new NFC Push action for each message.

 

Pushing a message

The NFC Push option enables you to define the NFC message that you want to transmit. In the combo box (see screenshot below), select the Standard Type of the message to be transmitted. These types are as defined in the NFC technical specifications.

MTActionNFCPush02MsgOptions

Text, URI, and MIME-Media types

Definitions of the Text, URI, and MIME Media standard types are straightforward (but see the URI options below the next screenshot). The screenshot below shows an NFC message with three records, each of which defines a different standard type. Message contents can be XPath strings, or can come from source tree nodes. In the last record, for example, the message's contents are taken from a node in an XML page source.

MTActionNFCPush01

The following URI options are available:

 

SMS URI: The sent SMS will be opened in the receiving device's SMS app. The URI would look something like this: "sms:+439991234567?body=MyBody"

Telephone URI: The telephone app on the receiving device will be opened, and the transmitted telephone number will be dialed. Example URI: "tel:+439991234567"

Email URI: The sent email will be opened in the receiving device's email app. Example URI: "mailto:name@altova.com?subject=MySubject&body=MyBody"

 

 

In some types of messages (see the NFC technical specifications), the message content must be explicitly converted to hexBinary so that it can be stored and transported in the payload of the NFC message. If you wish to convert a string to hexBinary, you can use the XPath extension function mt-string-to-hexBinary. Images can be converted from Base64 to hexBinary with the mt-base64-to-hexBinary function. When an NFC payload is received on a device (see Discovering and Reading NFC Tags), the hexBinary can be converted back to a string or a Base64 image by using, respectively, the XPath extension functions mt-hexBinary-to-string and mt-hexBinary-to-base64.

 

 

Pushing images

If you wish to transmit an image via an NFC Push message, you can do this by using the relevant MIME media type for that image (see screenshot below for an example). When defining this kind of message, you will need to convert the Base64 format of the image to hexBinary so that the image can be transported in the payload of the NFC message. For this conversion, use the XPath extension function mt-base64-to-hexBinary. To convert the hexBinary (on the receiving device) back to a Base64 image, use the function mt-hexBinary-to-base64.

MTActionNFCPush04Images

Advanced types

For messages that are of the Advanced type, a specific advanced type must be selected (see screenshot below). For each advanced type, enter the respective text and specify any other relevant information.

MTActionNFCPush03AdvancedTypes

For a description of NFC's advanced types, see the NFC technical specifications.

 

Beaming a file with Android Beam

If Android Beam is enabled on two Android devices, then files can be beamed from one device to the other. Select the Android Beam and Push radio buttons (see screenshot below), and then define how the file that the user will transmit is to be selected.

MTActionNFCPushABeam

This file must be located on the client device. The file can be specified directly in the design or you can let the user select the file (see screenshot below).

 

If you specify the file directly and if the path is relative, then the path will be resolved relative to the base directory that you specify for Android devices. The screenshot below shows the dialog with the option Let user select file on device selected. The Optional File Filter setting filters the file types that can be opened via the browse dialog of the client device; only those file extensions that you have defined here are allowed. You can enter: (i) a comma-separated or semicolon-separated list of extensions (for example: txt,html;xml), or (ii) an XPath expression that returns a sequence of string items, where each string item is a file type extension (for example, here is one sequence containing three string items: 'txt','html,'xml').

MTActionNFCPushABeamUserFile

 

Canceling a push/beam

The Cancel action enables you to cancel the selected push or beam action.

MTActionNFCPushCancel

 

© 2019 Altova GmbH