Reputation: 21
I'm building an Android app with Cordova. I'm also using the chariotsolutions phonegap-nfc plugin, to read NFC/NDEF tags.
My app opens when I pass a tag but don't read the content, because the listeners aren't set already, so I want to know if doing some modification or something to the plugin, is posible to send the data and read it on the first tag passing.
I found this article where it explains how to do it while the app is in background. My app already do this, when is running it cames from background and read the tag. In my case is when the app is totally close, not in background.
Similar article: chariotsolutions phonegap-nfc plugin intent
I'd appreciate some help with this one, or any directions about it.
Thank you for the help!
Upvotes: 1
Views: 1765
Reputation: 2283
Yes it's possible to launch a Cordova app with a NFC tag and process the NFC tag contents in your app.
See this sample project https://github.com/don/nfc-launch
There's an intent filter in AndroidManifest.xml for the NFC tag to launch the app. There's nfc.addMimeTypeListener in index.js to process the tag. See the README and comments in index.js for more info.
Upvotes: 1