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

前端 未结 2 596
小鲜肉
小鲜肉 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: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();

提交回复
热议问题