Skip to content
Docs and guides

Help Center

Step-by-step guides for every setting in App Studio.

NFC Scanner

Updated

Read NFC tags for authenticity checks and loyalty.

Enable a native plugin, configure its settings, then rebuild and install the app.
Native plugin changes require a new build. Follow this guide for the exact settings and supported methods.View full size
  • JavaScript: window.AppSorcerer.nfc
  • Plan: Business (premium) — included on plans with premium plugins, and you can try it free for 14 days
  • Platforms: Android apps today. iOS support arrives with iOS builds (coming soon).
  • Android permissions: NFC

Turn the plugin on in App Studio → Plugins, fill in its settings, then rebuild your app. Websites call it through the JavaScript bridge.

Settings

Studio labelTypeDefaultNotes
Read NDEF records onlytoggletrue

Setup

Nothing to configure. The phone only listens for tags while a scan is running and the app is open.

JavaScript API

Every method returns a Promise. Call it as await AppSorcerer.nfc.<method>(args).

MethodArgumentsResolves with
isAvailable–{ available, enabled }
scan{ timeoutMs = 60000, readNdefOnly? }{ id, techTypes, ndef: { type, maxSize, isWritable, records } | null }
stopScan–null (the pending scan rejects with canceled)
openSettings–opens the NFC settings

Record: { tnf, type, id, payload (base64), recordType: 'text' \| 'uri' \| 'mime' \| 'external' \| 'other', text?, language?, uri?, mimeType? }. readNdefOnly defaults to the setting (true): tags without NDEF data reject with no_ndef; with false they resolve with ndef: null.

Events

Listen with AppSorcerer.on('<event>', callback) (or the DOM event appsorcerer:<event>).

EventData
nfc.tagsame object as the scan() result

Errors

Rejections carry error.code: unavailable, disabled, busy, timeout, canceled, no_ndef, read_failed, unknown_method.

Example

JavaScript
try {
  const tag = await AppSorcerer.nfc.scan({ timeoutMs: 30000 });
  const url = tag.ndef?.records.find((r) => r.recordType === 'uri')?.uri;
  if (url) location.href = url;
} catch (e) {
  if (e.code === 'disabled') await AppSorcerer.nfc.openSettings();
}

Notes

  • Phones without NFC can still install your app.
  • Writing tags isn't supported.
Was this helpful?