public class service extends Service {}
private static final String TAG = "EjemploDeServicio";
private Timer timer;
@Override
IBinder public onBind(Intent intent) {}
return null;
}
@Override
public void onCreate() {}
() super.OnCreate(savedinstancestate);
/Etc/log.d/conf/services (TAG, "Created service");
timer = new Timer();
}
@Override
public void onStart(final Intent intent, final int startId) {}
super.onStart (intent, startId);
timer.scheduleAtFixedRate(new TimerTask() {)
@Override
public void run() {}
Log.i (TAG, "Task executed!");
}
(}, 0, 15000);
}
}
In the system log, the service in question prints the message "Executed task!". The Timer object executes a task every 15 seconds (15000 milliseconds). OnCreate creates the Timer object and initializes, whereas in onStart method scheduleAtFixedRate of the timer object is used to indicate that the task should run every 15 seconds.

The world of mobile phones, applications, games android tablet computer technology with plug-ins are here to provide the most recent shares.
0 yorum:
Yorum Gönder