Broadcastreceiver Doesn't Receive Anything After Being Force Killed Then Restarted
Solution 1:
I have a BroadcastReceiver that I register dynamically in the onCreate method for my Service. It receives the action fine at first, but if the app is force killed and then restarted it doesn't receive anything.
I am assuming that "force killed" means that you went into Settings and pressed the "Force Stop" button. If so, there are multiple reasons for this.
Tactically, if you register a BroadcastReceiver
via registerReceiver()
, it will only be available until the corresponding unregisterReceiver()
call, or until your process is terminated if you leak the receiver.
Even if you move the receiver to be registered in the manifest, if you force-stop your app, that receiver will not receive any more broadcasts, until the user runs your activity (or something else triggers your code via an explicit Intent
).
The reason I'm force killing is that I'd like to test my app from a completely unstarted state, and even when I do "stop process" from Eclipse there seems to be some part still running
When you terminate your process using DDMS, your process is no longer running.
Post a Comment for "Broadcastreceiver Doesn't Receive Anything After Being Force Killed Then Restarted"