小编Chr*_*ium的帖子

Android onHandleIntent和onStartCommand之间的区别

我目前正在编写一个需要的android程序IntentService.当我将代码放在onHandleIntent函数中时,代码不会运行,但它不会给出错误MainActivity.但是当我将代码复制到其中时onStartCommand,它运行得很好.

问题是我想知道onHandleIntent和之间有什么区别onStartCommand.谢谢.

码:

onHandleIntent:

System.out.println("SERVICE STARTED! ! !");
//System.out.println(intent.getBooleanExtra("once", Boolean.FALSE));
if (intent.getBooleanExtra("once", Boolean.FALSE)) {
    Check();
}
mHandler.postDelayed(mRunnable, 3000);
Run Code Online (Sandbox Code Playgroud)

android android-service intentservice

13
推荐指数
2
解决办法
1万
查看次数

标签 统计

android ×1

android-service ×1

intentservice ×1