I have a widget that implements a specific broadcast receiver service to detect when the wifi connection goes down.
It works perfectly if the main activity is running or not.
The issue I have is when I stop the main activity then the broadcast receiver service stops as I don't detect anymore the wifi changes.
Is there a way to startservice that survives the main activity?
if not, any other mechanisms?
Probably you need to register your receiver in manifest and mark it as exported=true
, so it can work if the app is not running. Check this link for detailed info please https://developer.android.com/guide/components/broadcasts
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With