I'm registered a BroadcastReceiver for the ACTION_TIME_TICK inside my AppWidgetProvider to update a clock every minute. Like in this example:
AFAIK a BroadcastReceiver that is registered at runtime is only active as long as the application is running. But from my understanding the AppWidgetProvider could get garbage collected at any time and it doesn't have a real lifecycle anyway.
For the last 30 minutes this has been working great but is this really (still?) a viable method?
How long will the BroadcastReceiver stay registered in theory?
Update:
I simulated a ram shortage with a memory filler app and checked the list of running processes with adb shell ps -A. Once the process was terminated the updates to the clock did in fact stop.