chariotsolutions / phonegap-nfc

PhoneGap NFC Plugin
MIT License
712 stars 570 forks source link

Callback not fired for share and unshare always fails #83

Closed Gh0s7 closed 11 years ago

Gh0s7 commented 11 years ago

The callbacks for the share event are not fired on WP8 (no alert is shown when I call those methods) nfc.share(ndefMessage, function(){alert('shared');}, function(){alert('share failed');});

Also, the nfc.unshare always fails.

nfc.unshare(function(){alert('unshared');}, function(){alert('unshare failed');}); This code alwasy shows the second alert and the share stays on even after calling unshare. (WP8 again)

don commented 11 years ago

I think this might be a problem with alerts not firing. Try the same code with console.log() instead. If you need an alert, I think you need to wrap it in a setTimeout() on WP8.

The code should fire events when calling share, but not when the tags is shared with the peer https://github.com/chariotsolutions/phonegap-nfc/blob/master/src/windows-phone-8/NfcPlugin.cs#L112

If the tag never is shared, I think it makes sense that unshare should fail.

don commented 11 years ago

Re-open if the solution above doesn't work