Service的編寫 創建一個類(這里為FirstService)繼承android.app.Service,并覆蓋以下方法: onBind(Intent intent) Return the communication channel to the service. onCreate() Called by the system when the service is first created. onStartCommand(Intent intent, int flags, int startId) Called by the system every time a client explicitly starts the service by calling startService(Intent), providing the arguments it supplied and a unique integer token representing the start request. onDestroy() Called by the system to notify a Service that it is no longer used and is being removed.