Service的两种启动方式的不同

startService:
正常调用:onCreate->onStart
取消绑定:onDestroy
如果调用者自己直接退出而没有调用stopService,则Service会一直在后台运行,直到下次调用者再启动起来,并明确调用stopService

bindService
正常调用:onCreate->onBind
取消绑定:onUnbind->onDestroy

猜你喜欢

转载自lichunan-d-163-com.iteye.com/blog/1629063