Android ADB (Android Debug Bridge) Sending broadcast

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

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

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

adb shell am broadcast -a action com.test.app.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:

-p com.test.app

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

-n com.test.app/.SomeReceiver

Useful examples:



Got any Android Question?