Service的生命周期方法有 onCreate onStartCommand onStart onDestroy 开启服务的方法是 startService(intent)关闭服务的方法是stopService(intent),服务职能被开启一次,开启的时候会调用onCreate onStartCommand onStart, 再次开启不会调用onCreate方法,只会调用onStartCommand onStart 方法,停止服务会调用onDestroy,停止了就可以再次开启,会调用onCreate onStartCommand
onStart方法。
Service
最新推荐文章于 2023-03-04 22:15:00 发布