发送广播
模拟发送关机广播 :adb shell am broadcast -n com.example.qrcodescanner/.BootReceiver -a "android.intent.action.BOOT_COMPLETED"
发送sdcard插入广播:adb shell am broadcast -n com.example.qrcodescanner/.SdcardReceiver -a "android.intent.action.MEDIA_MOUNTED"
恢复出厂:adb shell am broadcast -a android.intent.action.MASTER_CLEAR
捕获广播:adb shell dumpsys activity | grep BroadcastRecord
检测SD卡实时插拔效果:
adb shell dumpsys activity | grep BroadcastRecord |grep MEDIA
启动服务
am startservice -n [包 (package) 名]/[包名].