对于startService和bindService这两种Service的启动流程如下:
1.通过service调用者(ServiceHolder)发送intent到服务(Service),调用启动服务函数startService()/bindService()
2.接受者接收到服务后:
startService 走下面流程 onCreate->onstart->onDestroy
如果调用者直接退出还没调用stopservice,则service一直在后台运行。直到下次stopService为止
bindService 走下面流程 onCreate->onUnbind->onDestroyed
绑定指的是,调用者ServiceHolder和服务接受者(Service)同生共死,如果调用者退出,Service会调用onUnbind->onDestroyed一起共赴黄泉。
上述两种Service,OnCreate()方法永远只调用一次,如果服务已经启动,
对于startService直接调用startService(),对于bindService()直接调用bindService()。