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

后端 未结 7 1237
鱼传尺愫
鱼传尺愫 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 02:00

    Here's a simplified description:

    • stopSelf() is used to always stop the current service.

    • stopSelf(int startId) is also used to stop the current service, but only if startId was the ID specified the last time the service was started.

    • stopService(Intent service) is used to stop services, but from outside the service to be stopped.

    This is the reference page.

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