Code example for ScheduledExecutorService

Methods: scheduleWithFixedDelay

0
        Log.d(TAG, "MessageCheckService start");
        if (this.schedualService == null) {
            this.schedualService = Executors.newScheduledThreadPool(1);
        } 
 
        this.schedualService.scheduleWithFixedDelay(command, initialDelay, delay, TimeUnit.MILLISECONDS);
        return START_STICKY;
    } 
 
    /** 
     * 执行Task 
     */ 
    private Runnable command = new Runnable() {
        @Override 
        public void run() { 
            Log.d(TAG, "check message"); 
                handler.sendEmptyMessage(0); 
        } 
    }; 
 
    /**