Skip to content
Eric Lorite Palomino edited this page Oct 21, 2022 · 3 revisions

Contents

Classes

NdefTools

Class that provides methods for reading and writing ndef tags

Methods

cancelRequest (): void

Method for cancelling the current listener

readTag (): Promise<NdefTagInfo | undefined>

Function that listens until a Ndef tag is detected in the device's NFC reader. Then returns the id of the ndef tag and its decoded payload as a "content" property

writeTag (value: string): Promise

Function that writes a value as the payload of a Ndef tag and returns a boolean wether the card was written successfully or not

HceTools

Class that provides methods for emulating a Ndef card with your phone

Attributes

hceSession: HCESession

The singleton hce session provided by react-native-hce

Methods

Method to remove the current read listener

startEmulation (options: HceOptions, onRead: HceReadHandler: Promise

Method to start a hce emulation and execute a callback once is read

stopEmulation (): Promise

Method to stop the current card emulator (triggers removeListener)

Types

HceOptions

Attributes

content: string

The payload of the Ndef tag that will be emulated in your phone

writable: boolean

Wether the Ndef tag that will be emulated in your phone can be assigned another payload (content) or not

HceReadHandler

(): void

Callback that will be triggered when the emulated tag is read

NdefTagInfo

Attributes

id: string

The Ndef tag unique id

content: string

The Ndef tag decoded payload