Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sendBroadcast in a BroadcastReceiver

Tags:

android

Is there anything wrong with sending a broadcast in a broadcast receiver?

like image 707
yydl Avatar asked Feb 22 '11 04:02

yydl


People also ask

What is the role of the onReceive () method in the BroadcastReceiver?

Retrieve the current result extra data, as set by the previous receiver. This can be called by an application in onReceive(Context, Intent) to allow it to keep the broadcast active after returning from that function.

What is the method name in BroadcastReceiver receive the message?

To receive SMS messages, use the onReceive() method of the BroadcastReceiver class. The Android framework sends out system broadcasts of events such as receiving an SMS message, containing intents that are meant to be received using a BroadcastReceiver.

How do I check if BroadcastReceiver is registered?

Currently there is no way to check if a receiver is registered using the receiver reference. You have to unregister the receiver and catch the IllegalArgumentException that is thrown if it's not registered. This is ugly, and a boolean method to check if it's registered would be helpful.

What file is used to register the BroadcastReceiver?

Register Broadcast: Statically (manifest-declared) - This receiver can be registered via the AndroidManifest. xml file.


1 Answers

I don't think there is any problem with sending a broadcast again from within a BroadcastReceiver.

You can see similar example here.

To study more about broadcast receivers plese see the following.

like image 163
N-JOY Avatar answered Oct 03 '22 20:10

N-JOY