Good day! Please tell me what could be the reason:
There is a service, it launches a task on a schedule (5 minutes), but the task is carried out completely horizontally. Maybe 3 times without a break be executed, maybe in three minutes, maybe in ten .. How can this be? I thought maybe they are breeding in me, brought this into the logs from the task - they are the same everywhere, it turns out that the timer is dancing as it wants? But is it possible?
It is described as:
@Override public int onStartCommand(Intent intent, int flags, int startId) { if (!iam_started) { iam_started = true; if (TT==null) { TT = new myTimerTask(); T2 = new Timer(); if (TT != null && T2 != null) T2.scheduleAtFixedRate(TT, 1000, 1000*60*5); } ... }
Well, there I myself:
private class myTimerTask extends TimerTask { public void run() { } }
Is that what I'm doing wrong? ...