android - 关于service的生命周期的疑问
天蓬老师
天蓬老师 2017-04-17 17:46:54
0
1
612

关于service的生命周期,我看书发现有3种情况,startService()、bindService()、先startAervice()再bindService(),他们所经历的生命周期都是不一样的。我很好奇为什么没有先bindService()再startService()这种情况?我发现不是一本书是这样的,求解。谢谢

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(1)
伊谢尔伦

Both start and bind will go through to determine whether the Service is created. If it is not created, it will be created (onCreate method execution), and then when a specific method is called, onStartCommand will be called if it is start, and when the stopService method is not called, the The Service will always be in the running state. If it is bind, the onBind method will be called. If the unbindService method is called, the onUnbind method of the Service will be called. At the same time, it will check whether there are other callers of the Service before bind. If so, the Service will not stop. If not, the Service will automatically stop (onDestory callback)

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template