darryncampbell / darryncampbell-cordova-plugin-intent

General purpose intent shim layer for cordova appliations on Android. Handles various techniques for sending and receiving intents.
MIT License
86 stars 136 forks source link

Receive Broadcast when app is not started #82

Closed ChiSamurai closed 4 years ago

ChiSamurai commented 4 years ago

Hi,

we are trying to implement a communication between different apps using broadcasts. While native Android apps receive broadcasts even if they are not started (not running in background), our Ionic app using this cordova plugin only receives broadcasts when the app is running.

Is this even possible somehow through cordova and this plugin?

darryncampbell commented 4 years ago

Hi, do you mean by registering for the broadcast intent in the application manifest? https://developer.android.com/guide/components/broadcasts#manifest-declared-receivers Google removed that capability for most Intents starting with Oreo which is why this plugin does not use that technique.

ChiSamurai commented 4 years ago

Ah yes, that was exactly the purpose. I wasn't aware that this feature is deprecated. Thanks for pointing me to that announcement.

ChiSamurai commented 4 years ago

Hi, sorry for re-activating this issue, but it came up again the last days since we are updating an app using your plugin to android 8.1. But while investigating on this question I understood it that way that it is indeed still valid to register a BC-receiver in the manifest but sending implicit intents are only valid for some system events.

So... registering a BC receiver in the manifest (to "get the app aware of intents even if not running") and address it directly by sending an explicit intent should be valid. Or am I wrong?

darryncampbell commented 4 years ago

Yes, you can still register a broadcast receiver in the manifest and send explicit intents. That works in Android but this plugin does not expose a way to modify the manifest to register a receiver.

ChiSamurai commented 4 years ago

Okay, thanks a lot for your answer. So I have to find another way to handle that :-)