引用
If this BroadcastReceiver was launched through a <receiver> tag, then the object is no longer alive after returning from this function. This means you should not perform any operations that return a result to you asynchronously -- in particular, for interacting with services, you should use startService(Intent) instead of bindService(Intent, ServiceConnection, int). If you wish to interact with a service that is already running, you can use peekService(Context, Intent).
peekService
引用
Provide a binder to an already-running service. This method is synchronous and will not start the target service if it is not present, so it is safe to call from onReceive(Context, Intent).
在实际操作中,通过peekservice并不能获得已经通过startservice开启的service对象。但是可以采用ServiceManger的addservice方法来注册service,并通过getservice获得该service,注意,getservice之前该service并不会启动。由serviceManager进行管理
分享到:
相关推荐
Android Service与BroadcastReceiver、bindService示例详解,代码非常详细,详解博客网址:http://blog.csdn.net/sunboy_2050/article/details/7364024
android BroadcastReceiver 源码 学习
Android BroadcastReceiver
android BroadcastReceiver相关测试代码。我测试所用的。
android BroadcastReceiver两种注册方式:1.在AndroidManifest.xml中注册 2.在Activity中注册。两种注册BroadcastReceiver方法的比较: 现在我们了解了两种注册BroadcastReceiver的方法之后,需要考虑一下这两种方法...
Android学习之BroadcastReceiver总结
主要为大家详细介绍了Android BroadcastReceiver接收收到短信的广播,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
Android下BroadcastReceiver的简单示例。详见博客:http://www.cnblogs.com/plokmju/p/android_BroadcastReceiver.html
Android \BroadCastReceiver 最全的简介
Android四大组件之一,BroadcastReceiver的实例Demo。
android广播实现方式
Android BroadcastReceiver 广播的用法 用了一个简单的Dome举例
上一次介绍了Android BroadcastReceiver的广播发送,这一次主要介绍有序广播的发送。
Android-BroadcastReceiver高级应用,详细参见博客:http://www.cnblogs.com/plokmju/p/android_SystemBroadcastReceriver.html
在Android开发应用过程中 Android BroadcastReceiver经常会用到,所以抽时间整理了一番,省的后续在用到的时候再去百度。 BroadcastReceiver几种常见监听 1.BroadcastReceiver监听拨号 <intent android:priority=...
本集中提到的BroadcastReceiver就是此应用的典范。Android通过广播机制,能够让订阅者接受到想听到的广播,并进行进一步的处理和操作。如果你想在虚拟的android世界中创建属于你自己的电台广播,那么就赶紧点击本集...
主要介绍了Android BroadcastReceiver广播注册方式总结的相关资料,需要的朋友可以参考下