i developed an application which sends birthday wishes on facebook wall, but when i am calling someone at same time that i set for sending wishes, then wishes failed to post on facebook wall. I used Alarm Manager first. But i want to use timer class and in that timer class i want to check that message is posted to wall or not at defined time or if not then i want to reschedule the timer class to send post. i have this code for timer class
private final Timer clockTimer;
private class Task extends TimerTask {
public void run() {
timerHandler.sendEmptyMessage(0);
}
}
private final Handler timerHandler = new Handler() {
public void handleMessage (Message msg) {
// runs in context of the main thread
timerSignal();
}
};
private List<SystemTimerListener> clockListener = new ArrayList<SystemTimerListener>();
public SystemTimerAndroid() {
clockTimer = new Timer();
clockTimer.schedule(new Task(), 1000, 1000);
}
private void timerSignal() {
for(SystemTimerListener listener : clockListener)
listener.onSystemTimeSignal();
}
public void killTimer() {
clockTimer.cancel();
}
@Override
public void addListener(SystemTimerListener listener) {
clockListener.add(listener);
}
this code is repeating after every second so i want to check if it runned for first time then stop the timer and reschedule for next day and so on... Please help me.