android service bindService onServiceConnected没有调用
来源:互联网 发布:excel用按钮录入数据 编辑:程序博客网 时间:2024/06/05 00:36
http://blog.sina.com.cn/s/blog_749e806f0100yikk.html
开始代码如下:、
public void onCreate(Bundle b){
,最后找了好久,在一个外国网站上找到如下:
http://stackoverflow.com/questions/3792344/why-isnt-onserviceconnected-called
This is the designed behavior of all of these methods. For example,in the bindService(Intentservice, ServiceConnection conn, intflags)
The service will be considered required by the system only for aslong as the calling context exists. For example, if this Context isan Activity that is stopped, the service will not be required tocontinue running until the Activity is resumed.
For unbindService(ServiceConnection conn)
Disconnect from an application service. You will no longer receivecalls as the service is restarted, and the service is now allowedto stop at any time.
In the startService(Intentservice)
Using
startService()
overridesthe default service lifetime that is managed by bindService(Intent,ServiceConnection, int)
: it requires the service to remainrunning untilstopService(Intent)
iscalled, regardless of whether any clients are connected to it. Notethat calls to startService()
arenot nesting: no matter how many times you call startService()
,a single call tostopService(Intent)
willstop it.
也就是说:在绑定的的时候Context 不可以为空,在OnCreate中绑定,当然contexe没有完成啊!
所以就把代码转移到和服务链接器连接成功里面调用!
private ServiceConnection conn=new ServiceConnection(){
- android service bindService onServiceConnected没有调用
- Service的onServiceConnected没有被调用
- Service的onServiceConnected没有被调用
- Service的onServiceConnected没有被调用
- Android Service在bindService不能触发onServiceConnected方法
- Android Service在bindService不能触发onServiceConnected方法
- bindService后,onServiceConnected方法没有执行
- bindService不调用onServiceConnected的问题
- Android AIDL bindService后不能调用onServiceConnected方法(一种情况)
- 调用了bindService()之后,程序执行了Service里的onBind(),但是为什么不执行ServiceConnection对象接口onServiceConnected()呢?
- bindService不能触发onServiceConnected方法
- Android Service之bindService
- Android Service(绑定BindService)
- android 之 Service(Context BindService())
- Android SERVICE(详解二 Bindservice)
- Android中Service使用bindService
- android Service---bindService和remoteService
- bindService不能触发onServiceConnected方法的原因
- 2014年广州区域赛总结Accelerator
- 思维导图
- 格式化format()输出字符串
- 第十三周项目5---统计大小字母的个数
- MySQL多表查询之GroupBy
- android service bindService onServiceConnected没有调用
- Java网络编程之TCP、UDP
- 快速排序算法
- Relief算法应用
- V4L2驱动程序架构
- 树及二叉树实验第一题
- C语言-求两个整数中的较大者
- wholesale nfl jerseys supply
- TextView