How to run GPS listener in background using service - Android

How to run GPS listener in background using service - Android

private Handler handler;

onCreate(){
   handler = new Handler();
   handler.post(gpsListenr);
}

Runnable gpsListener = new Runnable(){
    public void run(){
         // do something and then call again this listener by handler with delay time
         handler.postDelay(gpsListener,1000); /// this will call gpslistener every 1 sec.
    }
}


Learn More :