chariotsolutions / phonegap-nfc

PhoneGap NFC Plugin
MIT License
706 stars 556 forks source link

Receive extra data on startup with AAR record #261

Closed SamVerschueren closed 6 years ago

SamVerschueren commented 7 years ago

Thanks for this plugin. It works very well!

The only thing I can't seem to figure out is how I can get the data/event when starting my application with my NFC tag. To clarify, I added 2 records to my NFC tag.

  1. Data record (Content-Type + Data)
  2. AAR (Android Application Record) pointing to my application ID

I registered the listener with nfc.addMimeTypeListener and everything works well if the application is already open. I get the data and am able to react on it. When my application is closed, the NFC tag opens the application due to the AAR record on the tag but the mimeType hook is not called. Is this possible with this plugin via a method/flag?

don commented 7 years ago

You need to add an intent filter to the manifest that opens the app when scanning your tag.

See https://github.com/chariotsolutions/phonegap-nfc#launching-your-android-application-when-scanning-a-tag