It is easy to find on google which is the broadcast receiver to listen for sms messages. Is there also a similar receiver to listen for gtalk messages or new emails?
Thanks
Neither of those applications are part of the SDK, so there are no documented broadcast Intents for either action -- sorry!
Related
I want to know all broadcast message that occur at Android system or third-party application.
Broadcast messages that occur at Android system are so easy to know because make broadcast receiver, add intent-filter(all broadcast action) and receive :).
But messages that occur at third-party application are difficult to know because i don't know there broadcast message action :(
How to receive broadcast intent at third-party application?
There is no way to indiscriminately register for any broadcast event, but you can list all historical broadcasts and registered broadcast receivers with the following terminal command:
dumpsys activity broadcasts
Essentially, you would receive only those broadcasts for which you have registered. It is not feasible/possible to receive all the broadcasts. In fact, if it is somehow possible, it would be a HUGE security breach !!!
I'm confusing about these question.please help me in these question
Many applications registered the broadcast receiver with the same action and one application send the broadcast then what will happen?
Does all apps will receive the that intent or only one app will receive the intent ?
can we registered the multiple receivers in the same application?
if we registered the two receivers with same action in the same application then what will happen?
All receivers will receive the broadcast.
Broadcast Receivers are designed to provide notification about a single event to multiple receivers.
There is only one exception to this statement, if a broadcast is an Ordered broadcast, then the broadcast will be propagated sequentially to all receivers one after another(based on priority) and any of the receiver can decide to prevent broadcast from propagating further. The broadcast receiver for SMS is a good example of ordered broadcast.
Yes, multiple receivers can be registered in the same app.
Both the receivers will receive the intent as expected.
Is it possible to broadcast any message from any Service which is running in background so that any broadcast receiver from that app or any other app can receive the message?
The broadcastreceivers must have some filter and if your broadcast doesn't set this filter your broadcast wouldn't receive the broadcast.
So if you would like to send some message to all of your broadcastreceivers, then all of them should have the same filter properties, but then they are unnecessary.
See the documentation for further details.
When you use sendBroadcast(Intent) or related methods, normally any other application can receive these broadcasts. You can control who can receive such broadcasts through permissions described below.
-> http://developer.android.com/reference/android/content/BroadcastReceiver.html
I don't think so. The service should send a specific message, and only the apps that listen for that message will intercept it.
A fellow developer and I have started to question whether a broadcast announcement is guaranteed to be received by the appropriate broadcast receiver.
We have a broadcast receiver which receives messages that should be put on to the screen. Occasionally we notice that some messages never make it to the screen.
Even with the debugger, it has been hard to tell for certain if the receiver is not getting the broadcast or if it due to our own bugs that the broadcast is never sent.
So I wanted to ask generally if there are any known reasons why the broadcast receiver would not receive an announcement?
There are ordered broadcasts in Android. They are sent to receivers according to the receivers priority. And receiver with a higher priority can abort the broadcast spreading.
See this blog post for details.
I am trying to implement an app that will only listen for a certain header in the SMS.
(Parse the sms message and look for some header)
That's not hard to do.
The problem is once the app finds the header and knows this SMS is for me,
I don't want other app(that has broadcast listener on SMS) to receive SMS.
(for example, 'messages' to pop-up with sms message)
Is there a way to listen SMS before any other apps and decide to pass on to other app
or don't pass to other apps?
See one of the answers for the following question Can we delete an SMS in Android before it reaches the inbox?. It explains how to receive the BROADCAST, set the priority of your app so you receive the broadcast first so you could do your checks then cancel the broadcast so no other app receives it.
Read about BroadcastReceiver. You should use ordered broadcast - use android:priority attribute, and then call abortBroadcast() in your BroadcastReceiver.