Code example for ScheduledThreadPoolExecutor

Methods: scheduleAtFixedRate

public class NotificacaoService extends Service {
	public int onStartCommand(Intent intent, int flags, int startId) {
		ScheduledThreadPoolExecutor pool = new ScheduledThreadPoolExecutor(1);
		long delayInicial = 0;
		long periodo = 10;
		TimeUnit unit = TimeUnit.MINUTES;
		pool.scheduleAtFixedRate(new NotificacaoTask(), 
								delayInicial, periodo,unit);
		return START_STICKY;
	public IBinder onBind(Intent intent) {
		return null; 
	private boolean estaConectado() { 
Connect your IDE to all the code out there  Get Codota for Java