Contribute
This is a stub and is waiting for contributions. Get involved by visiting us on GitHub or joining us on Discord.
Based on https://github.com/tauri-apps/plugins-workspace/tree/plugins/nfc
Read and write NFC tags on Android and iOS.
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 nfcyarn run tauri add nfcpnpm tauri add nfcbun tauri add nfccargo tauri add nfcRun the following command in the src-tauri folder to add the plugin to the project’s dependencies in Cargo.toml:
cargo add tauri-plugin-nfc --target 'cfg(any(target_os = "android", target_os = "ios"))'Modify lib.rs to initialize the plugin:
#[cfg_attr(mobile, tauri::mobile_entry_point)]pub fn run() {    tauri::Builder::default()        .setup(|app| {            #[cfg(mobile)]            app.handle().plugin(tauri_plugin_nfc::init());            Ok(())        })        .run(tauri::generate_context!())        .expect("error while running tauri application");}Install the JavaScript Guest bindings using your preferred JavaScript package manager:
npm install @tauri-apps/plugin-nfcyarn add @tauri-apps/plugin-nfcpnpm add @tauri-apps/plugin-nfcbun add @tauri-apps/plugin-nfcOn 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:
<?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>Contribute
This is a stub and is waiting for contributions. Get involved by visiting us on GitHub or joining us on Discord.
Based on https://github.com/tauri-apps/plugins-workspace/tree/plugins/nfc
This permission set configures what kind of operations are available from the nfc plugin.
Checking if the NFC functionality is available and scanning nearby tags is allowed. Writing to tags needs to be manually enabled.
allow-is-availableallow-scan| Identifier | Description | 
|---|---|
| 
 
  | 
 Enables the is_available command without any pre-configured scope.  | 
| 
 
  | 
 Denies the is_available command without any pre-configured scope.  | 
| 
 
  | 
 Enables the scan command without any pre-configured scope.  | 
| 
 
  | 
 Denies the scan command without any pre-configured scope.  | 
| 
 
  | 
 Enables the write command without any pre-configured scope.  | 
| 
 
  | 
 Denies the write command without any pre-configured scope.  | 
© 2024 Tauri Contributors. CC-BY / MIT