我的IntentService怎么启动不了呢?

charlesxu charlesxu 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
debug了下,能执行到this.startService(mServiceIntent);然后就没反应了,即进不了IntentServcie的onCreate,也进不了onHandleIntent

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);
...全文

相关推荐

评论 7
收藏 已收藏
分享
返回顶部
charlesxu
Android 80,490 成员 91,371 内容