stopSelf() vs stopSelf(int) vs stopService(Intent)

后端 未结 7 1235
鱼传尺愫
鱼传尺愫 2020-12-29 00:56

What\'s the difference in calling
stopSelf() , stopSelf(int) or stopService(new Intent(this,MyServiceClass.class))
inside

7条回答
  •  有刺的猬
    2020-12-29 01:37

    stopSelf(int)- which is used to stop most recent start service based on onStartCommand(Intent i, int f, int startid)'s int startid.

    stopSelf()- which is called by service itself , when task has been completed.

    stopService(Intent) - which is explicitly called from an activity to stop the service.

提交回复
热议问题