Location Tacking with Gps
<p>I am using service class which gives a call to my inner class that implements Location Listener which provides me my location details... but I need to do this in regular interval.. I have used Thread with looper but it executes only once Please help </p>

<p>This is my udated answer
Updated answer </p>

<pre><code>    public class MyService extends Service 
{
     String GPS_FILTER = "";
     Thread triggerService;
     LocationListener locationListener;
     LocationManager lm;
     private static final long MINIMUM_DISTANCE_CHANGE_FOR_UPDATES = 1000; // in Meters
     private static final long MINIMUM_TIME_BETWEEN_UPDATES = 1000*60; // in Milliseconds
     protected LocationManager locationManager;
     boolean isRunning = true;
     @Override
     public void onCreate() 
     {
           // TODO Auto-generated method stub
           super.onCreate();
           GPS_FILTER = "MyGPSLocation";
//           locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
//           locationManager.requestLocationUpdates(
//                   LocationManager.GPS_PROVIDER, 
//                   MINIMUM_TIME_BETWEEN_UPDATES, 
//                   MINIMUM_DISTANCE_CHANGE_FOR_UPDATES,
//                   new MyLocationListener());
     }

     @Override
     public void onStart(Intent intent, int startId)
     {
           // TODO Auto-generated method stub
           super.onStart(intent, startId);     
           turnGPSOn();
           Toast.makeText(getApplicationContext(), "Hello1",Toast.LENGTH_LONG).show();
           LocationManager locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
           locationListener = new MyLocationListener();
           locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,MINIMUM_TIME_BETWEEN_UPDATES, 1.0f, locationListener);

     }

     @Override
     public void onDestroy() {
           // TODO Auto-generated method stub
           super.onDestroy();
          // removeGpsListener();
     }

     @Override
     public IBinder onBind(Intent intent) {
           // TODO Auto-generated method stub
           return null;
     }

//     private void removeGpsListener(){
//           try{
//                 lm.removeUpdates(locationManager);
//           }
//           catch(Exception ex){
//                 System.out.println("Exception in GPSService --- "+ex);
//           }
//     }


     private class MyLocationListener implements LocationListener
     {

         public void onLocationChanged(Location location) 
         {
            postdata(location.getLatitude(),location.getLongitude());
             String message = String.format(
                     "New Location \n Longitude: %1$s \n Latitude: %2$s",
                     location.getLongitude(), location.getLatitude()
             );
             Toast.makeText(MyService.this, message, Toast.LENGTH_LONG).show();
             turnGPSOnOff();
         }

         public void onStatusChanged(String s, int i, Bundle b) {
//              Toast.makeText(MyService.this, "Provider status changed",
//                     Toast.LENGTH_LONG).show();
         }

         public void onProviderDisabled(String s) {
//             Toast.makeText(MyService.this,
//                     "Provider disabled by the user. GPS turned off",
//                     Toast.LENGTH_LONG).show();
         }

         public void onProviderEnabled(String s) {
//             Toast.makeText(MyService.this,
//                     "Provider enabled by the user. GPS turned on",
//                     Toast.LENGTH_LONG).show();
         }

     }
</code></pre>

<p>also call service using </p>

<pre><code> Calendar cur_cal = Calendar.getInstance();
   cur_cal.setTimeInMillis(System.currentTimeMillis());
   Intent intent = new Intent(this, MyService.class);
   PendingIntent pintent = PendingIntent.getService(login.this, 0, intent, 0);
   AlarmManager alarm = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
   alarm.setRepeating(AlarmManager.RTC_WAKEUP, cur_cal.getTimeInMillis(), 60*1000, pintent);
</code></pre>
