时候使用adb命令发送广播测试或者启动某个服务会更有效率。
1.使用am broadcast命令发送广播 命令如下:
adb shell am broadcast -n "com.autonavi.amapauto/com.autonavi.amapauto.adapter.internal.AmapAutoBroadcastReceiver" -a AUTONAVI_STANDARD_BROADCAST_RECV --ei "KEY_TYPE" 10047 --ei "EXTRA_CASUAL_MUTE" 1
同源码的效果:
private void setNaviCasualMute(int mute) {
? ? Intent intent = new Intent();
? ? intent.setClassName("com.autonavi.amapauto", "com.autonavi.amapauto.adapter.internal.AmapAutoBroadcastReceiver");
? ? intent.setAction("AUTONAVI_STANDARD_BROADCAST_RECV");
? ? intent.putExtra("KEY_TYPE", 10047);
? ? intent.putExtra("EXTRA_CASUAL_MUTE", mute);
? ? mContext.sendBroadcastAsUser(intent, UserHandle.SYSTEM);
}
格式: am broadcast -n “包名/广播接收Receiver” -a 广播名 --ei 参数Key 参数Value --ei 参数Key 参数Value
2.使用am startservice 命令启动服务 命令如下:
am startservice -n com.iflytek.cutefly.speechclient.hmi/com.iflytek.auto.speechclient.sdk.SpeechClientService --es "stopvr" "navi"
3. -p? packages name?
??????https://medium.com/swlh/extend-the-adb-to-make-app-debugging-easier-59d42fa8cf71https://medium.com/swlh/extend-the-adb-to-make-app-debugging-easier-59d42fa8cf71
|