nfc

package
v0.0.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package nfc reads NFC tags.

nimbus native plugin add nfc

if nfc.Available(ctx) {
	tag, err := nfc.Read(ctx, "Hold your card near the phone")
}

iPhones also need the NFC capability turned on for the app in your Apple developer account. Written against the platform APIs, but not yet run: simulators and emulators have no NFC.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Available

func Available(ctx context.Context) bool

Available reports whether this phone can read tags.

Types

type Tag

type Tag struct {
	ID      string   `json:"id"`      // hex
	Records []string `json:"records"` // NDEF text and links, when it has any
}

Tag is what was read.

func Read

func Read(ctx context.Context, prompt string) (Tag, error)

Read waits for a tag. prompt shows on iPhone's scanning sheet. It fails with plugin.Cancelled if they back out; a cancelled ctx stops it on Android.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL