Naresh
Naresh

Reputation: 31

How to get Location for certain time interval

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

Answers (3)

Ronak Mehta
Ronak Mehta

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

MAC
MAC

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

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

Related Questions