I 开发者_C百科 have a app which is a single activity app , it listens to many broadcast event , my question is that how can I ensure that I receive all the fired intent which i have added for my app even when my app is not in foreground and running in background ??
is there a certain method where I should add my intent filter and do the registerReciever ? I'm sure it won't work if I keep it in "Oncreate"
any ideas or help ??
It sounds like you want to be using a BroadcastReceiver to pick up the events when you are in the 'background'. This will pick up events which are actually broadcast without having to launch a UI.
You can set up the BroadcastReceiver and its intent filters in the manifest for your application, this way you dont have to rely on any java code being run to register the receivers.
精彩评论