Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1015689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:26:17+00:00 2026-05-16T10:26:17+00:00

This is the way I listen for GPS location updates (using LocationManager and a

  • 0

This is the way I listen for GPS location updates (using LocationManager and a LocationListener):

locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
listener = new MyLocationistener(); // LocationListener
locationManager.requestLocationUpdates(
        LocationManager.GPS_PROVIDER, 
        30000, // milliseconds (minTime)
        20, // meters (minDistance)
        listener );

But I would like to dynamically adjust the minTime and minDistance arguments used by LocationManager#requestLocationUpdates. My aim is to save battery, according to several usage policies, i.e.:

  • If the user is not moving, increase the minTime to get a location update
  • If the user is moving very fast, increase the minDistance
  • If the user is indoors (no GPS coverage), increase both
  • If the battery is too low, increase both
  • … (any other heuristic)

I would like to know:

  1. Is this really a good idea to save battery life ?
  2. How could I do that kind of adjustments? I can call both LocationManager#removeUpdates and LocationManager#requestLocationUpdates again, if there is the only alternative.
  3. Any idea or sample code you know to implement this kind of adaptive algorithms ?

Edit: The application is a tracking system to know where people are, in order to assign tasks to the person nearest to a given poing. Actually battery hardly lasts 8 hours, so I’d like to increase it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T10:26:18+00:00Added an answer on May 16, 2026 at 10:26 am

    AFAIK you need to call removeUpdates and requestLocationUpdates again.

    Also, you can look into other ways to see if the phone is moving at all, like the accelerometer. Read about it here and see this other question’s answers

    But To give you more ideas, you need to present the problem itself. Don’t try to optimize too early, until you don’t have a problem. If you have you need to post details about it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I established a connection with a client this way: gen_tcp:listen(1234,[binary,{packet,0},{reuseaddr,true},{active,false},{recbuf,2048}]). This code performs message
Is this the most efficient way to listen to mouse events on the background
When debugging HTML is there a way to listen for div width change using
Consider this way of solving the Subset sum problem: def subset_summing_to_zero (activities): subsets =
I populated comboboxes in this way foreach (Control c in this.Controls) { if (c
There is this way, of course: OuterClass.this . But that's very clumsy. Ideally, there'd
I followed this way. To create a workspace to manage your source-controlled files 1.
I added the legend this way: leg = fig.legend((l0,l1,l2,l3,l4,l5,l6), ('0 Cl : r2, slope,
I send data in this way: <form method=post enctype=text/plain action=Func> And I have a
This is the first time I have manipulated hashes and arrays in this way

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.