Skip to content

nfc

AbsoluteURI: 3;

Empty: 0;

Media: 2;

NfcExternal: 4;

NfcWellKnown: 1;

Unchanged: 6;

Unknown: 5;

IsoDep: 0;

MifareClassic: 1;

MifareUltralight: 2;

Ndef: 3;

NdefFormatable: 4;

NfcA: 5;

NfcB: 6;

NfcBarcode: 7;

NfcF: 8;

NfcV: 9;

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

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.

PropertyTypeDefined in
idnumber[]
kindstring[]
recordsTagRecord[]

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

PropertyTypeDefined in
host?string
pathPrefix?string
scheme?string

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 ScanKind: object | object;

const RTD_TEXT: number[];

const RTD_URI: number[];

function isAvailable(): Promise<boolean>

Promise<boolean>


function record(
format,
kind,
id,
payload): NFCRecord
ParameterType
formatNFCTypeNameFormat
kindstring | number[]
idstring | number[]
payloadstring | number[]

NFCRecord


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.

ParameterTypeDescription
kindScanKind
options?ScanOptions

Promise<Tag>


function textRecord(
text,
id?,
language?): NFCRecord
ParameterTypeDefault value
textstringundefined
id?string | number[]undefined
language?string'en'

NFCRecord


function uriRecord(uri, id?): NFCRecord
ParameterType
uristring
id?string | number[]

NFCRecord


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.

ParameterTypeDescription
recordsNFCRecord[]
options?WriteOptions

Promise<void>