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 !!!
Related
Android developer portal states broadcasts which can be registered in manifest itself, but it gives a caution as under
Even though these implicit broadcasts still work in the background,
you should avoid registering listeners for them.
One such broadcast which is exempted is as under:
ACTION_LOCKED_BOOT_COMPLETED, ACTION_BOOT_COMPLETED
Exempted because
these broadcasts are only sent only once, at first boot, and many apps
need to receive this broadcast to schedule jobs, alarms, and so forth.
If we should avoid registering them (as per the above caution), then what is the right approach for ACTION_BOOT_COMPLETED ?
Use case: Sync data with the server and show a notification to user (if any)
If you need your app started at boot time, the only way to do this is to have a manifest-registered BroadcastReceiver.
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.
I have an application with a broadcast receiver, and I'm trying to figure out how to receive the broadcast of when an app from the Market is purchased and/or installed. Is this possible?
I've tried setting a receiver for android.Intent.ACTION_PACKAGE_ADDED and com.android.vending.billing.PURCHASE_STATE etc.
There isn't a way of receiving a broadcast intent on purchase/install of the application. From what I recall reading about this in the past, is that it's a security concern.
From the API, it even states that a new application won't receive the ACTION_PACKAGE_ADDED broadcast intent. PURCHASE_STATE is also irrelevant since the app isn't installed yet at purchase time.
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.
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!