onStart() and onStartCommand() still called in 2.0 and higher

前端 未结 2 577
小鲜肉
小鲜肉 2021-01-12 19:11

According to this blog post and the documentation of onStartCommand() if you have a Service you should implement onStart() and onStartCommand() and in 2.0 and higher only on

相关标签:
2条回答
  • 2021-01-12 19:23

    On that blog post, the base implementantions of onStart and onStartCommand are not called. Pressumably, one of them is calling the other.

    0 讨论(0)
  • 2021-01-12 19:35

    The source code of onStartCommand() is:

        public int onStartCommand(Intent intent, int flags, int startId) {
            onStart(intent, startId);
            return mStartCompatibility ? START_STICKY_COMPATIBILITY : START_STICKY;
        }
    

    So it still calls onStart();

    0 讨论(0)
提交回复
热议问题