我的IntentService怎么启动不了呢?
debug了下,能执行到this.startService(mServiceIntent);然后就没反应了,即进不了IntentServcie的onCreate,也进不了onHandleIntent
manifest里的注册:
IntentService的代码:
在Activity里启动IntentServcie的代码
manifest里的注册:
<application>
<service android:name="com.aaa.ggg.IntentServcie_my"/>
</application>
IntentService的代码:
public class BackgroundService extends IntentService {
public BackgroundService() {
super("BackgroundService");
}
@Override
protected void onHandleIntent(Intent intent) {
String tmp = intent.getStringExtra("strr")
}
@Override
public void onCreate() {
// TODO Auto-generated method stub
super.onCreate();
}
在Activity里启动IntentServcie的代码
Intent mServiceIntent = new Intent(this, com.aaa.ggg.IntentServcie_my.class);
mServiceIntent.putExtra("strr", "str_val");
this.startService(mServiceIntent);
...全文
相关推荐
深入剖析Android系统中Service和IntentService的区别
主要介绍了Android系统中Service和IntentService的区别,与普通的服务相比,IntentService可以开启单独的线程来处理intent请求,需要的朋友可以参考下
IntentService使用Demo
IntentService使用示例,原理以及用途,详细说明了IntentService运行流程
android 中的服务Service intentService例子
NULL 博文链接:https://zhanglimijavaeye.iteye.com/blog/1881599
IntentService
IntentService基本使用方法Demo
IntentService模拟上传图片
对于有写工作,我们需要在后台进行,这里主要介绍了使用IntentService轻松实现模拟上传图片的例子。对于IntentServixce和Service扩展类的使用区别,大家可以自行去了解研究一下。


