Sending broadcast

suggest change

It is possible to send a broadcast to a BroadcastReceiver with adb.

In this example we are sending a broadcast with action com.test.app.ACTION and string extra 'foo'='bar':

adb shell am broadcast -a com.test.app.ACTION --es foo "bar"

You can put any other supported type in the extras, 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 an intent to a specific package or class, the -n or -p parameter can be used. Sending to a package:

-p com.test.app

Sending to a specific component (SomeReceiver in the com.test.app package):

-n com.test.app/.SomeReceiver

Useful examples:

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents