Is it possible that BroadcastReceiver in an activity which have gone to background receiving broadcast? If not, what should I do?
EDIT:
Let me clarify what I really need. I have a service that will receive data from bluetooth. When it get data from blue-tooth device successfully, the service will broadcast.
And there are three cases of the activity.
- foreground
Popup a dialog and ask for user something I think it can be simply done by register receiver in activity
- background
I just don't know how to do this part. If I register the receiver in application, notification is shown. After taking a look of the answers below, I think I can register in Application.
- sleep Wake up the device.
Thank You.