美文网首页
Service的两种启动方式

Service的两种启动方式

作者: fsdffdaga | 来源:发表于2017-02-21 20:29 被阅读0次

一、Context.startService()

 * 声明周期:

Service中                                    Context中

----------------------------------------------------------------------------------------

onCreate()                            <----startService()

onStartCommand()              

onDestory()                          <----stopService() / Service#stopSelf()


二、Context.bindService()

* 声明周期:

Service中                                    Context中

----------------------------------------------------------------------------------------

onCreate()                            <----bindService()

onBind()

onUnbind()                          <----unBindService()

onDestory()

相关文章

网友评论

      本文标题:Service的两种启动方式

      本文链接:https://www.haomeiwen.com/subject/fsecyttx.html