Essential Android ADB Android Debug Bridge edit forum

Sending broadcast

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:


Table Of Contents
33 ADB Android Debug Bridge
39 ACRA
64 Menu
112 Loader
119 Xposed
132 Colors
135 Fresco
140 AdMob
147 Button
156 Vk SDK
170 XMPP
176 OpenCV
200 FileIO
203 Moshi
217 Paint
231 AIDL
241 JCodec
243 Okio
255 Looper
  ↑ ↓ to navigate     ↵ to select     Esc to close