Skip to content

nfc

Enumerations

NFCTypeNameFormat

Enumeration Members

AbsoluteURI
AbsoluteURI: 3;

Empty
Empty: 0;

Media
Media: 2;

NfcExternal
NfcExternal: 4;

NfcWellKnown
NfcWellKnown: 1;

Unchanged
Unchanged: 6;

Unknown
Unknown: 5;

TechKind

Enumeration Members

IsoDep
IsoDep: 0;

MifareClassic
MifareClassic: 1;

MifareUltralight
MifareUltralight: 2;

Ndef
Ndef: 3;

NdefFormatable
NdefFormatable: 4;

NfcA
NfcA: 5;

NfcB
NfcB: 6;

NfcBarcode
NfcBarcode: 7;

NfcF
NfcF: 8;

NfcV
NfcV: 9;

Interfaces

NFCRecord

Properties

PropertyTypeDefined in
formatNFCTypeNameFormat
idnumber[]
kindnumber[]
payloadnumber[]

ScanOptions

Properties

PropertyTypeDescriptionDefined in
keepSessionAlive?boolean-
message?stringMessage displayed in the UI. iOS only.
successMessage?stringMessage displayed in the UI when the message has been read. iOS only.

Tag

Properties

PropertyTypeDefined in
idnumber[]
kindstring[]
recordsTagRecord[]

TagRecord

Properties

PropertyTypeDefined in
idnumber[]
kindnumber[]
payloadnumber[]
tnfNFCTypeNameFormat

UriFilter

Properties

PropertyTypeDefined in
host?string
pathPrefix?string
scheme?string

WriteOptions

Properties

PropertyTypeDescriptionDefined in
kind?ScanKind-
message?stringMessage displayed in the UI when reading the tag. iOS only.
successfulReadMessage?stringMessage displayed in the UI when the tag has been read. iOS only.
successMessage?stringMessage displayed in the UI when the message has been written. iOS only.

Type Aliases

ScanKind

type ScanKind: object | object;

Variables

RTD_TEXT

const RTD_TEXT: number[];

RTD_URI

const RTD_URI: number[];

Functions

isAvailable()

function isAvailable(): Promise<boolean>

Returns

Promise<boolean>


record()

function record(
format,
kind,
id,
payload): NFCRecord

Parameters

ParameterType
formatNFCTypeNameFormat
kindstring | number[]
idstring | number[]
payloadstring | number[]

Returns

NFCRecord


scan()

function scan(kind, options?): Promise<Tag>

Scans an NFC tag.

import { scan } from "@crabnebula/taurify-api/nfc";
await scan({ type: "tag" });

See https://developer.android.com/develop/connectivity/nfc/nfc#ndef for more information.

Parameters

ParameterTypeDescription
kindScanKind
options?ScanOptions

Returns

Promise<Tag>


textRecord()

function textRecord(
text,
id?,
language?): NFCRecord

Parameters

ParameterTypeDefault value
textstringundefined
id?string | number[]undefined
language?string'en'

Returns

NFCRecord


uriRecord()

function uriRecord(uri, id?): NFCRecord

Parameters

ParameterType
uristring
id?string | number[]

Returns

NFCRecord


write()

function write(records, options?): Promise<void>

Write to an NFC tag.

import { uriRecord, write } from "@crabnebula/taurify-api/nfc";
await write([uriRecord("https://tauri.app")], { kind: { type: "ndef" } });

If you did not previously call scan with ScanOptions.keepSessionAlive set to true, it will first scan the tag then write to it.

Parameters

ParameterTypeDescription
recordsNFCRecord[]
options?WriteOptions

Returns

Promise<void>