摘要:
一、广播的实现1、监听短信的广播public class SmsBroadcastReceiver extends BroadcastReceiver{ @Override public void onReceive(Context context, Intent intent) { Object[] pdus=(Object[])intent.getExtras().get("pdus"); for(Object pdu:pdus) { byte[] date=(byte[])pdu; ... 阅读全文
posted @ 2012-08-31 16:57
VinceXie
阅读(1455)
评论(0)
推荐(0)
摘要:
ps:Service是运行在主线程中的!所以耗时操作会阻塞主线程!一、本地service的应用以及生命周期(1)通过startService来启动的Service使用context.startService() 启动Service是会会经历: context.startService() ->onCreate()- >onStart()->Service running context.stopService() | ->onDestroy() ->Service stop 所以调用startService的生命周期为:onCreate --> onStar 阅读全文
posted @ 2012-08-31 15:47
VinceXie
阅读(1302)
评论(0)
推荐(0)
摘要:
1、简介Android中提供了Intent机制来协助应用间的交互与通讯,Intent负责对应用中一次操作的动作、动作涉及数据、附加数据进行描述,Android则根据此Intent的描述,负责找到对应的组件,将Intent传递给调用的组件,并完成组件的调用。Intent不仅可用于应用程序之间,也可用于应用程序内部的Activity/Service之间的交互。因此,Intent在这里起着一个媒体中介的作用,专门提供组件互相调用的相关信息,实现调用者与被调用者之间的解耦。在SDK中给出了Intent作用的表现形式为:·通过Context.startActivity(intent)orAct 阅读全文
posted @ 2012-08-31 12:06
VinceXie
阅读(291)
评论(0)
推荐(0)