chariotsolutions / phonegap-nfc

PhoneGap NFC Plugin
MIT License
706 stars 557 forks source link

Question: Detect if ran from intent vs normal tag read #236

Closed ghost closed 8 years ago

ghost commented 8 years ago

Hi, I know how to read tag and launch it from intent.

The question is how do I make difference, if app was launched from Intent or tag was read after app already opened?

don commented 8 years ago

All tags come from intents, so there's not really a good way to do that.

When the app is launched by scanning a tag, you'll receive a ndef-mime event.

If the tags you are scanning a not TNF_MIME_MEDIA, you can use a NDEF listener. This way the MIME listener gets tags launching the app and the NDEF listener gets tags after the app is launched.

ghost commented 8 years ago

Thank you, I thought about this solution, needed confirmation.