Maddy Sharma
Maddy Sharma

Reputation: 4956

User Location updates in every 30 minutes

How to find user updated location after every 30 minutes but there is no requirement to draw the map... The requirement is just to find the location and send it to any server after every 30 minutes.???

Thanks in advance...

Upvotes: 0

Views: 376

Answers (2)

john murimi
john murimi

Reputation: 31

The most reliable method according to me is have an AlarmManager wake up a Service every n minutes and send location updates to server.

Don't rely on the minimum time set on the LocationListener.

This is from personal experience (I have an app where I was using this method and it was totally unreliable).

Upvotes: 2

John J Smith
John J Smith

Reputation: 11941

Do it in a background service, and when you implement the LocationListener interface, you can send the location off to your server in the onLocationChanged(Location location) method e.g.

@Override
public void onLocationChanged(Location location)
{           
    // Send location to server...

    locationManager.removeUpdates(this);            
    detachLocationListeners();
}

Upvotes: 0

Related Questions