In GPS manager, I am getting the location update for every minutes in my Log.
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,60000,0, this);
This line did the trick.
LOG:
02-03 11:32:33.045 6217-6217/com.example.mylocation E/onLocationChanged﹕ 17.3732643
02-03 11:32:33.045 6217-6217/com.example.mylocation E/onLocationChanged﹕ 78.5046052
02-03 11:33:33.245 6217-6217/com.example.mylocation E/onLocationChanged﹕ 17.3732721
02-03 11:33:33.245 6217-6217/com.example.mylocation E/onLocationChanged﹕ 78.5046024
02-03 11:34:33.315 6217-6217/com.example.mylocation E/onLocationChanged﹕ 17.3732627
02-03 11:34:33.315 6217-6217/com.example.mylocation E/onLocationChanged﹕ 78.5046052
02-03 11:35:33.215 6217-6217/com.example.mylocation E/onLocationChanged﹕ 17.3732669
02-03 11:35:33.215 6217-6217/com.example.mylocation E/onLocationChanged﹕ 78.5046055
02-03 11:36:33.145 6217-6217/com.example.mylocation E/onLocationChanged﹕ 17.3732575
02-03 11:36:33.145 6217-6217/com.example.mylocation E/onLocationChanged﹕ 78.504606
How to update this information in my database.
This service starts on a button click, so I've implemented Asynctask in which http call send data to database
This is happening only once, data is entered in database only once i.e. on button click, whenever onLocationChanged() is called updated data not sent to database
public void onLocationChanged(Location location)
{
latitude = location.getLatitude();
longitude = location.getLongitude();
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 60000, 0, this);
Log.e("onLocationChanged",Double.toString(latitude));
Log.e("onLocationChanged", Double.toString(longitude));
}
Kindly help in solving this issue