adb 发送广播 && 恢复出厂

adb 发送广播 && 恢复出厂

发送广播

adb shell am broadcast -a 广播名android.intent.action.BOOT_COMPLETED

这条命令可以更精确的发送到某个package,如下:

adb shell am broadcast -a android.intent.action.BOOT_COMPLETED -c android.intent.category.HOME -n package_name/class_name

启动activity/service

在adb shell中,通过am命令行启动一个Activity程序:

从superuser源代码中摘录一段使用示例:

adb shell am start -a android.intent.action.MAIN -n com.koushikdutta.superuser/com.koushikdutta.superuser.SuperuserRequestActivity

这个示例中:

-a 表示action (android.intent.action.MAIN)

-n 表示packagename (com.koushikdutta.superuser)

SuperuserRequestActivity是对应的Activity name

关机

adb shell am broadcast -a android.intent.action.ACTION_SHUTDOWN -c android.intent.category.HOME -n com.andy.androidtest/.ShutdownBroadcastReceiver

恢复出厂设置

adb shell am broadcast -a android.intent.action.MASTER_CLEAR

10.0可以用下方法

1、

adb shell am broadcast -a android.intent.action.MASTER_CLEAR

adb shell "echo "--wipe_data\n--locale=en_US" > /cache/recovery/command"

adb shell setprop sys.powerctl reboot,recovery

2、

am broadcast -a android.intent.action.FACTORY_RESET -p android --es android.intent.extra.REASON MasterClearConfirm

相关推荐
针叶7 小时前
Google Play加固保护导致的崩溃
android·安全·google
执明wa9 小时前
Android Studio 项目目录结构全方位详解
android·ide·android studio
__Witheart__10 小时前
Android编译错误:Soong阶段因缺失res目录导致panic (Iwlan模块)
android
酿情师11 小时前
逆向exe文件:CRT 初始化流程详细分析
android·软件构建·逆向·re·crt‘
问心无愧051312 小时前
ctf show web入门71
android·前端·笔记
夜勤月13 小时前
AQS 与 ThreadPoolExecutor 深度拆解:JDK 高并发底层设计精髓
android·java·开发语言
Yeyu13 小时前
Android 卡顿诊断 SDK:从痛点出发的设计思考
android
上天_去_做颗惺星 EVE_BLUE14 小时前
Ubuntu Android 虚拟机安装使用教程
android·linux·测试工具·ubuntu·安卓
我命由我1234514 小时前
Android 开发问题:Could not find com.github.PicnicSupermarket:FingerPaintView:1.2.
android·github·android studio·安卓·android jetpack·android-studio·android runtime