call method every 15 minutes [closed]

You are already requesting location updates from the system, just increase the time of the frequency from 100 milliseconds to 15 mintutes. Change this line:

locationManager.requestLocationUpdates(locationProvider,100,100, new MajListener()); 

to this:

locationManager.requestLocationUpdates(locationProvider,(15 * 60 * 1000),100, new MajListener()); 

Note also that since you are inside of an Activity you are going to stop getting callbacks when the user navigates away from the activity.

If you want this to run in the background (and thus not get closed when the user navigates away) you will need to put it into a Service instead of an Activity

Browse More Popular Posts

Leave a Comment