bsorrentino / cordova-broadcaster

Cordova Plugin to allow message exchange between javascript and native (and viceversa)
MIT License
113 stars 53 forks source link

Would it be possible to support full (non-local) broadcast? #1

Closed shankari closed 8 years ago

shankari commented 9 years ago

I believe that local broadcast does not work if an app is restarted via an intent service... I am happy to make the change and submit a pull request, but wanted to check whether that fit in with your vision for the plugin...

bsorrentino commented 9 years ago

Hi shankari

Sorry for late in answer ... probably i lost notification .. :-(

I've developed such plugin to make my "dev life" easier :-)

I'm glad to hear that you would like contribute ... my vision is make little things that work well

I consider your proposal like a bug fix, so gladly i'll accept your pull request

Thanks for interest

shankari commented 8 years ago

It turns out that my code didn't really require global broadcast. Mainly because global broadcast is useful if you are running in the background and want to create/wake up a broadcast receiver if it doesn't exist. In the case of cordova, if the webview is not actively running, should we really deliver events to it? Doesn't that mean that we need to start the activity and load the javascript as well?

Given that, I chose to use LocalBroadcastManager so that my webview would receive events when it was present, but not receive events if it had been killed.