stopSelf()方法来停止服务

使用Service的stopSelf()方法来停止服务,要注意这是一个父类的方法,调用了这个方法之后,服务停止的时间不

确定,后面的代码还是会执行,并且onDestroy()方法也会执行,

下次重新启动服务的时候,先调用onCreate(),然后再调用onStart()方法。

关键是下一次onCreate(),

猜你喜欢

转载自blog.csdn.net/gezi322/article/details/105857506
今日推荐