Code example for ScheduledExecutorService

Methods: shutdownNow

0
	}	 
	 
	@Override	 
	public void onDestroy() {	 
		Toast.makeText(this, "PowService stopped", Toast.LENGTH_LONG).show();
		if (scheduleTaskExecutor != null) scheduleTaskExecutor.shutdownNow();
		//unregisterReceiver(batteryReceiver); 
		Log.d(TAG, "onDestroy");
	}	 
	 
	@Override 
	public void onStart(Intent intent, int startid) {	
		Log.d(TAG, "onStart");
		Bundle extras = intent.getExtras();
		resultReceiver = intent.getParcelableExtra("resultReceiver");
		if (extras == null) {
			serviceInterval = 1;
		} else { 
			serviceInterval = extras.getInt("loggingInterval");
		} 
		scheduleTaskExecutor = Executors.newScheduledThreadPool(5);