android service 运行方式有一下两种

其一:通过intent启动,走 oncreate()-->onstart()回调,销毁时走ondestory();

其二:bindService启动,走oncreate()-->onBind()回调,销毁时走onUnbind()-->ondestory()。

分析两种运行方式的控制行为

方式一:需要对service进行单独的处理,适用复杂的环境;

方式二:与activity关联,不需要考虑生命周期问题,管理方便。