Skip to content
Tauri

NFC

Read and write NFC tags on Android and iOS.

Supported Platforms

  • Android
  • iOS

Setup

This plugin requires a Rust version of at least 1.75

Install the nfc plugin to get started.

Use your project’s package manager to add the dependency:

npm run tauri add nfc

Configuration

On iOS the NFC plugin requires the NFCReaderUsageDescription information property list value, which should describe why your app needs to scan or write to NFC tags.

In the src-tauri/Info.ios.plist file, add the following snippet:

src-tauri/Info.ios.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NFCReaderUsageDescription</key>
<string>Read QR codes</string>
</dict>
</plist>

Usage

Default Permission

This permission set configures what kind of operations are available from the nfc plugin.

Granted Permissions

Checking if the NFC functionality is available and scanning nearby tags is allowed. Writing to tags needs to be manually enabled.

  • allow-is-available
  • allow-scan

Permission Table

Identifier Description

nfc:allow-is-available

Enables the is_available command without any pre-configured scope.

nfc:deny-is-available

Denies the is_available command without any pre-configured scope.

nfc:allow-scan

Enables the scan command without any pre-configured scope.

nfc:deny-scan

Denies the scan command without any pre-configured scope.

nfc:allow-write

Enables the write command without any pre-configured scope.

nfc:deny-write

Denies the write command without any pre-configured scope.


© 2024 Tauri Contributors. CC-BY / MIT