通过adb 发送广播
阅读原文时间:2021年04月20日阅读:1

adb shell am broadcast [options]
作用:发送一个广播
举例:adb shell am broadcast -a "send_by_frank_test" (发送一个广播send_by_frank_test)
举例:adb shell am broadcast -a android.intent.action.MASTER_CLEAR(恢复出厂设置的方法,会清除内存所有内容)
举例:adb shell am broadcast -n com.lt.test/.MyBroadcast

=================

通过命令行执行adb shell am broadcast发送广播通知。

adb shell am broadcast 后面的参数有:

[-a ]
[-d ]
[-t
[-c [-c ] …] 
[-e|--es …] 
[--ez …] 
[-e|--ei …] 
[-n ]
[-f ] []

例如:

adb shell am broadcast -a com.android.test --es test_string "this is test string" --ei test_int 100 --ez test_boolean true

说明:蓝色为key,红色为alue,分别为String类型,int类型,boolean类型

手机扫一扫

移动阅读更方便

阿里云服务器
腾讯云服务器
七牛云服务器

你可能感兴趣的文章