码迷,mamicode.com
首页 > 数据库 > 详细

adb shell am命令

时间:2014-11-11 17:58:15      阅读:183      评论:0      收藏:0      [点我收藏+]

标签:android   style   blog   http   io   color   ar   os   使用   

adb shell am命令是在cmd命令行可以通过命令来启动Activity,Boradcast,Service等,更多使用可以参考下面附件.

比如在cmd串口我们发送广播,广播action是"com.cmcc.media.bufferring" ,并且带key是"url",value是"http://www.baidu.com" 的数据给广播接收者,如下即可
am broadcast -a "com.cmcc.media.bufferring" --es "url" "http://www.baidu.com"

比如我们在APK中通过如下命令:
final String broadcastCmdStr = "*****";
Runtime.getRuntime().exec(broadcastCmdStr);
但是APK中会报错:
APK发送时候,无法发送成功,只要在发送broadcast的APK增加
android.permission.INTERACT_ACROSS_USERSandroid.permission.INTERACT_ACROSS_USERS_FULL权限即可。
接收端不需要处理


参考:
Android_adb shell am/pm使用
http://blog.sina.com.cn/s/blog_51335a0001017ux5.html
 
Android应用如何监听自己是否被卸载及卸载反馈功能的实现(第二版)
http://www.cnblogs.com/zealotrouge/p/3159772.html
 
Android控制台命令am简介
http://blog.csdn.net/hudashi/article/details/7782938
 
Android:adb shell am命令行发送Activity/Service/Broadcast
http://blog.csdn.net/annkie/article/details/7896559

adb shell am命令

标签:android   style   blog   http   io   color   ar   os   使用   

原文地址:http://www.cnblogs.com/lijunamneg/p/4089868.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!