chariotsolutions / phonegap-nfc

PhoneGap NFC Plugin
MIT License
706 stars 559 forks source link

`activated` event triggers NDEF callback #208

Closed jlkalberer closed 8 years ago

jlkalberer commented 8 years ago

When you start your app with an NFC intent you needed to write a bunch of boilerplate to make it work.

I changed this so that after you register NDEF with nfc.addNdefListener, the app launch parameters will trigger the success callback. Now you no longer need to write this code to listen for the activated event:

WinJS.Application.addEventListener("activated", function (eventArgs) {
    if (eventArgs.detail.kind == Windows.ApplicationModel.Activation.ActivationKind.protocol) {
        // eventArgs.detail.uri.rawUri;
    }
}, false);

I also reformatted the script.

jlkalberer commented 8 years ago

Nevermind... there isn't a good way to determine that this is a NDEF launch. It wouldn't make sense if the app started from some other means and triggered this.