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

相关推荐
JMchen1234 小时前
现代Android图像处理管道:从CameraX到OpenGL的60fps实时滤镜架构
android·图像处理·架构·kotlin·android studio·opengl·camerax
快点好好学习吧5 小时前
phpize 依赖 php-config 获取 PHP 信息的庖丁解牛
android·开发语言·php
是誰萆微了承諾5 小时前
php 对接deepseek
android·开发语言·php
Dxy12393102166 小时前
MySQL如何加唯一索引
android·数据库·mysql
冠希陈、8 小时前
PHP 判断是否是移动端,更新鸿蒙系统
android·开发语言·php
晚霞的不甘10 小时前
Flutter for OpenHarmony从零到一:构建《冰火人》双人合作闯关游戏
android·flutter·游戏·前端框架·全文检索·交互
2601_9498333911 小时前
flutter_for_openharmony口腔护理app实战+饮食记录实现
android·javascript·flutter
独自破碎E11 小时前
【滑动窗口+字符计数数组】LCR_014_字符串的排列
android·java·开发语言
stevenzqzq11 小时前
compose 中 align和Arrangement的区别
android·compose
VincentWei9511 小时前
Compose:MutableState 和 mutableStateOf
android