onserviceConnected()和startService()
来源:互联网 发布:程序员 英文面试 编辑:程序博客网 时间:2024/06/05 17:30
今天看到service的例子时候用serviceConnection的onserviceConnected()方法就想着和直接startService()方法有啥区别
<strong>startService(Intent intent)</strong>
<span style="font-size:12px;">bindService (Intent service, ServiceConnection conn, int flags)</span>
This function will throw SecurityException if you do not have permission to bind to the given service.
Note: this method can not be called from an BroadcastReceiver component. A pattern you can use to communicate from an BroadcastReceiver to a Service is to call startService(Intent) with the arguments containing the command to be sent, with the service calling its stopSelf(int) method when done executing that command. See the API demo App/Service/Service Start Arguments Controller for an illustration of this. It is okay, however, to use this method from an BroadcastReceiver that has been registered with registerReceiver(BroadcastReceiver, IntentFilter), since the lifetime of this BroadcastReceiver is tied to another object (the one that registered it).
这个方法不能被广播接收组件调用。
结论:
startService()是服务和intent分开的,从intent跳转到后面的service的。
serviceConnection()是绑定某个intent的。
0 0
- onserviceConnected()和startService()
- startService和bindService区别
- startService和bindService
- startService和bindService区别
- startservice 和bindservice详解
- bindService()和startService()区别
- startService和bindService
- Android StartService和BindService
- Android startService 和 bindService
- 理解startservice和bindservice
- startService和bindService
- Android startservice和bindservice
- startService()和bindService()区别
- startservice()和bindservice()区别
- startService()和bindService()区别
- startService和bindService区别
- startService和bindService
- StartService
- 近来,不好
- 银行柜面系统将是linux的天下
- 灰度图像--频域滤波 傅里叶变换之离散时间傅里叶变换(DTFT)
- 第一题的map版本
- 第2章 2.4 JSP声明
- onserviceConnected()和startService()
- VC++ 中遇到的一些warnings及其解决方法
- 使用HttpClient登陆网站 抓取页面数据
- hdu1879——继续畅通工程——————【kruskal模板】
- ZooKeeper介绍及典型使用场景
- java、C语言中default
- swift or oc?
- dinner
- 转场动画中的私有type,非常炫酷