第一頁 返回 繼續 最後一頁 摘要 圖形
Service的生命週期
Service 經過執行Context.startService() 啟動onCreate(),然後呼叫onStartCommand(Intent, int, int)
Service透過 Context.stopService()或
stopSelf()停止
當Client(通常是Activity)呼叫
Context.bindService() 時,如果service沒有執行,service就會被叫起來執行,但是僅會跑onCreate(),不會跑
onStartCommand(Intent, int, int)
Service中止會呼叫onDestroy()