-1

My requirement is I have to send longitude and latitude from Android to PHP server. I am able to get current latitude and and longitude using Service and LocationListener. I am also succeeded to send those data to PHP server using AsyncTask. But I could not call AsyncTask 15 min interval.

SMR
  • 6,628
  • 2
  • 35
  • 56
  • possible duplicate of [How do I schedule a task to run at periodic intervals?](http://stackoverflow.com/questions/4544197/how-do-i-schedule-a-task-to-run-at-periodic-intervals) – SMR Feb 20 '15 at 08:42

1 Answers1

1

Try to create a Timer:

Timer timer = new Timer();
timer.schedule(new TimerTask(){
    @Override
    public void run() {
        // do your thing here, such as execute AsyncTask or send data to server
    }
}, 1000, 900000); // starts your code after 1000 milliseconds, then repeat it every 15 minutes (900000 milliseconds)
Anggrayudi H
  • 14,977
  • 11
  • 54
  • 87