Android Sending broadcast


It's possible to send broadcast to BroadcastReceiver with adb.

In this example we are sending broadcast with action and string extra in bundle 'foo'='bar':

adb shell am broadcast -a action --es foo "bar"

You can put any other supported type to bundle, not only strings:

--ez  - boolean
--ei  - integer
--el  - long
--ef  - float
--eu  - uri
--eia - int array (separated by ',')
--ela - long array (separated by ',')
--efa - float array (separated by ',')
--esa - string array (separated by ',')

To send intent to specific package/class -n or -p parameter can be used.
Sending to package:


Sending to a specific component (SomeReceiver class in package):


Useful examples: