pax_nfc
A flutter pax plugin made to enable NFC capabilities on Android Pax Payment Devices (tested on A920 Pro)
Getting Started
To set it up you can either use a StreamBuilder and use the Stream<String> returned by the listenNfcStream method.
StreamBuilder(
stream: PaxNfc().listenNfcStream(),
builder: (context, snapshot) {
if (snapshot.hasData) {
handleNfcScan(snapshot.data!);
}
return Text('Scan NFC tag');
},
);
}
or listen to the stream directly and manage the StreamSubscription<String> returned by the
listen method.
PaxNfc().listenNfcStream().listen(
(data) {
handleNfcScan(data);
},
);
Upon reading, the plugin automatically stops and restarts its detection threads since they can only
be used once.
But it provides the option to start and stop them manually with the startNfcDetectionThreads,
and stopNfcDetectionThreads methods.
Errors I experienced
Couldn't find libDeviceConfig.so
In some dependent apps, the debugger said it couldn't find libDeviceConfig.so.
I resolved it by adding to my android/app/build.gradle file
jniLibs {
useLegacyPackaging true
}
Duplicate native libs
If you depend on another package made for Pax devices, chances are that it also packages native libs with it. and the combination of both packages in the same app produces errors that look like this:
2 files found with path 'lib/arm64-v8a/libDeviceConfig.so' from inputs
Resolved by adding to the android/app/build.gradle file of the dependent app
pickFirst '**/libc++_shared.so'
pickFirst '**/libDeviceConfig.so'
pickFirst '**/libpaxcanvas.so'
pickFirst '**/libHDSD.so'
pickFirst '**/libZBarDecoder.so'
pickFirst '**/libdecoder_jni.so'
pickFirst '**/libiconv.so'
pickFirst '**/libIGLBarDecoder.so'
It will pick the first occurrence of the library it encounters and use it.
Maintainance
I'm not actively maintaining this package but I will address issues