nfc_emulator

Last updated:

0 purchases

nfc_emulator Image
nfc_emulator Images
Add to Cart

Description:

nfc emulator

NFC Emulator #
A Flutter plugin to emulate the NFC tag. Supported only on Android (Apple is being Apple).
Installing #
Add to pubspec.yaml:
dependencies:
nfc_enumator: <latest version>
copied to clipboard
Android Setup #
Add NFC permissions to Android package's manifest file AndroidManifest.xml:
<uses-permission android:name="android.permission.NFC" />
<uses-feature android:name="android.hardware.nfc" android:required="false" />
<uses-feature android:name="android.hardware.nfc.hce" android:required="false" />
<uses-permission android:name="android.permission.VIBRATE" />
copied to clipboard
And aid_list.xml to the android/app/src/main/res/xml folder (create if not exist). See example project
File: aid_list.xml
```


```

Add emulator service with such metadata to AndroidManifest.xml:
<service
android:name="io.flutter.plugins.nfc_emulator.NfcEmulatorService"
android:exported="true"
android:permission="android.permission.BIND_NFC_SERVICE">

<!-- Intent filter indicating that we support card emulation. -->
<intent-filter>
<action android:name="android.nfc.cardemulation.action.HOST_APDU_SERVICE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<!--
Required XML configuration file, listing the AIDs that we are emulating cards
for. This defines what protocols our card emulation service supports.
-->
<meta-data
android:name="android.nfc.cardemulation.host_apdu_service"
android:resource="@xml/aid_list" />
</service>
copied to clipboard
Example of Usage #
Check NFC Status: #
// Check NFC Status
int nfcStatus = await NfcEmulator.nfcStatus;
copied to clipboard
Start NFC Emulator #
// Start NFC emulator with AID, cardUid, and optional AES key:
await NfcEmulator.startNfcEmulator("666B65630001", "cd22c716", "79e64d05ed6475d3acf405d6a9cd506b");
copied to clipboard
Stop NFC Emulator #
// Stop NFC emulator:
await NfcEmulator.stopNfcEmulator();
copied to clipboard
See more at: example project

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.