chariotsolutions / phonegap-nfc

PhoneGap NFC Plugin
MIT License
706 stars 559 forks source link

android: overwrite ndef mime tag #189

Closed lasterra closed 8 years ago

lasterra commented 9 years ago

I'm trying to write different kinds of tags, empty tag, ndef with knowed mimetype tags and ndef unknowed mimetype tag.

I was trying to do listening to nfc.addTagDiscoveredListener but the problem is that when i try to overwrite ndef mimetype tags i see in the logcat console that ndef-mime event is fired. In the second attemp tag listener is triggered ok.

i'm doing something wrong?

don commented 9 years ago

@lasterra nfc.addTagDiscoveredListener should handle all the tags allowing you to overwrite with your content. If you define additional listeners (e.g. ndef or mime-type) Android will call the most specific listener for your tag instead of the tag discovered. If you only have the nfc.addTagDiscoveredListener defined in your code it will catch the tags.

There is one exception. If you use an an intent filter to launch your app when a tag is scanned your application will receive a mime-type event.

What version of Android is on your phone? What hardware are you running?