Reputation: 31
I'm doing my project in android..
I want to get location for certain time interval (for fixed time) when button is clicked
for ex: each 10 min for 4hrs I want to get current location address.
how to get this? is there any timer control like visual basic? or any other method for doing it. thax in advance
Upvotes: 0
Views: 1244
Reputation: 5979
you can see this link get current device location after specific interval there is a working example of how to get Location information at certain time period
Upvotes: 0
Reputation: 15847
LocationManager mlocManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
LocationListener mlocListener = new MyLocationListener(context);
mlocManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1, 1,mlocL istener);
// syntax: mlocManager.requestLocationUpdates(provider, minTime, minDistance, listener)
you can set time and distance both in this method see ths syntax
Upvotes: 0
Reputation: 42016
you can use LocationListener
which gets called when your location get changed and moreover you can provide time interval too
public void requestLocationUpdates (String provider, long minTime, float minDistance, LocationListener listener, Looper looper)
refer http://www.firstdroid.com/2010/04/29/android-development-using-gps-to-get-current-location-2/
Upvotes: 1