Modules.Nfc.TagTechnology
> Modules.Nfc.TagTechnology

Represents an interface to a specific tag technology.

NFC tags are based on a number of independently developed technologies and offer a wide range of capabilities. The TagTechnology proxies provide access to these different technologies and capabilities. The TagTechnology proxy is the base type for more type-specific tag technologies. You will work with the type-specific tag technology proxies which provide capabilities for each tag technology.

Use one of the Modules.Nfc.createTagTechnologyIsoDep, Modules.Nfc.createTagTechnologyMifareClassic, Modules.Nfc.createTagTechnologyMifareUltralight, Modules.Nfc.createTagTechnologyNdefFormatable, Modules.Nfc.createTagTechnologyNdef, Modules.Nfc.createTagTechnologyNfcA, Modules.Nfc.createTagTechnologyNfcB, Modules.Nfc.createTagTechnologyNfcF, Modules.Nfc.createTagTechnologyNfcV method variants to create a tag technology proxy.

See also: TagTechnology

Examples

Write Ndef Tag

This example uses the TECH_NDEF tag technology to write a Modules.Nfc.NdefMessage message to a tag.

var tech = nfc.createTagTechnologyNdef({
    tag: scannedTag
});

if (!tech.isValid()) {
    alert("Failed to create Ndef tag type");
    return;
}

// Attempt to write an Ndef record to the tag
try {
    tech.connect();

    // It's possible that the tag is not writable, so we need to check first.
    if (!tech.isWritable()) {
        alert ("Tag is not writable");
    } else {
        // Create a new message to write to the tag
        var date = new Date();
        var textRecord = nfc.createNdefRecordText({
            text: "Titanium NFC module. Tag updated on " + date.toLocaleString() + "!!!"
        });
        var msg = nfc.createNdefMessage({
            records: [ textRecord ]
        });

        // Write to the tag
        tech.writeNdefMessage(msg);
    }
} catch (e) {
    alert("Error: " + e.message);
} finally {
    if (tech.isConnected()) {
        tech.close();
    }
}
  • 1.1.0
Defined By

Properties

apiName : Stringreadonly

The name of the API that this proxy corresponds to.

The name of the API that this proxy corresponds to.

The value of this property is the fully qualified name of the API. For example, Button returns Ti.UI.Button.

  • 3.2.0
  • 3.2.0
  • 3.2.0

The Window or TabGroup whose Activity lifecycle should be triggered on the proxy.

The Window or TabGroup whose Activity lifecycle should be triggered on the proxy.

If this property is set to a Window or TabGroup, then the corresponding Activity lifecycle event callbacks will also be called on the proxy. Proxies that require the activity lifecycle will need this property set to the appropriate containing Window or TabGroup.

  • 3.6.0
Modules.Nfc.TagTechnology
tag : Modules.Nfc.NfcTag

The tag technology that has been discovered.

The tag technology that has been discovered.

When a tag is discovered, a Modules.Nfc.NfcTag proxy is created and passed as a property to the onNdefDiscovered, onTagDiscovered, or onTechDiscovered callback (see NdefDiscovered).

Defined By

Methods

Modules.Nfc.TagTechnology
( )
Disable I/O operations to the tag and release resources. ...

Disable I/O operations to the tag and release resources.

Returns

  • void
Modules.Nfc.TagTechnology
( )
Enable I/O operations to the tag. ...

Enable I/O operations to the tag.

Only one Tag Technology proxy can be connected to a Tag at a time.

Returns

  • void
Gets the value of the apiName property. ...

Gets the value of the apiName property.

  • 3.2.0
  • 3.2.0
  • 3.2.0

Returns

  • String
Gets the value of the lifecycleContainer property. ...

Gets the value of the lifecycleContainer property.

  • 3.6.0

Returns

Modules.Nfc.TagTechnology
( ) : Modules.Nfc.NfcTag
Gets the value of the tag property. ...

Gets the value of the tag property.

Returns

Modules.Nfc.TagTechnology
( ) : Boolean
Returns true if connect has completed, and close has not been called, and the tag is not known to be out of range. ...

Returns true if connect has completed, and close has not been called, and the tag is not known to be out of range.

Returns

  • Boolean
Modules.Nfc.TagTechnology
( ) : Boolean
Return true if this tag technology was successfully obtained. ...

Return true if this tag technology was successfully obtained.

Returns

  • Boolean
Sets the value of the lifecycleContainer property. ...

Sets the value of the lifecycleContainer property.

  • 3.6.0

Parameters

Returns

  • void
Modules.Nfc.TagTechnology
( tag )
Sets the value of the tag property. ...

Sets the value of the tag property.

Parameters

Returns

  • void