1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
TimerTask task = new TimerTask() {
AlarmManager am = (AlarmManager)getSystemService(ALARM_SERVICE);
public void run() {
handler.post(new Runnable() {
private long firstTime;
public void run() {
firstTime = SystemClock.elapsedRealtime();
String name = "Service" ;
ReceiveData reception = new ReceiveData(name);
am.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,firstTime, 1000 * 60 * 2, proccess);
Coordonnees cord = new Coordonnees(reception.getLatitude(), reception.getLongitude(), reception.getAltitude(), reception.getPrecision(), reception.getVitesse(), reception.getDirection(), reception.getDate(), reception.getFournisseur());
MetierDao metier = new MetierDao(getApplicationContext());
metier.ajouter(cord);
Toast.makeText(ReceiveData.this, "Enregistrement Termine !", Toast.LENGTH_SHORT).show();
}
});
}
} ;
Timer timer = new Timer(true);
timer.schedule(task,period,period) ; //eclipse me souligne cette en rouge. personnellemnt , je ne vois pas d'erreur de syntax |
Partager