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 8307717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:35:21+00:00 2026-06-08T18:35:21+00:00

I am trying to optimise an Android application which must achieve the following: Every

  • 0

I am trying to optimise an Android application which must achieve the following:

  • Every hour, retrieve the GPS location and doSomeWork()

  • At any other time if the device moves more than @MINIMUM_DISTANCE, increase update frequency to something like 5 minutes to log the movement, when movement ends we can return to the hourly updates.

Now, AlarmManager firing every hour works a treat for the first requirement. It’s a fine battery efficient method of accomplishing this task. However I’m unsure how to best accomplish the second requirement.

Should I:

  • Register an AlarmManager which fires every 5 minutes in tandem with the hourly timer? Register LocationManager each time and attempt to pull off a location, compare to previous location to determine whether movement has occurred.

  • Register a LocationManager after my hourly wakeup with a minimum distance parameter equal to my required minimum movement.

  • Something else?

I can see pros and cons to each approach.

Using the LocationManager minimum distance parameter seems to me to be the more concise solution but I’m concerned about battery drain, will this keep the GPS running hot the whole time regardless of whether my application is receiving updates? I am also not sure where the best place to register the receiver would be, I understand it’s poor practice (not to mention nigh impossible) to keep a service running 100% of the time.

Yes I am new to Android! About to go and test the behaviour of LocationManager.

Thanks in advance.

  • 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-06-08T18:35:23+00:00Added an answer on June 8, 2026 at 6:35 pm

    My solution, which is working well, is to keep NETWORK_PROVIDER (and PASSIVE on the off chance I can get some updates for free) registered and listening any time the GPS_PROVIDER is not. If movement is seen outside the previously retrieved location, I can switch to full GPS to monitor the movement.

    Accuracy is poor, but at least sufficiently good. Battery consumption is remarkably low.

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

Sidebar

Related Questions

I'm trying to optimise the following C# code, which sets bytes to 0x00 or
I'm looking at trying to optimise a particular function in a PHP application and
I'm trying to optimise the following query in wordpress, as it takes nearly a
I've come across a weird problem whilst trying to optimise the following image: It
I'm trying to optimise a complex query in PostgreSQL 9.1.2, which calls some functions.
I'm trying to get my Android.mk file to optimize the binaries: LOCAL_PATH := $(call
I'm trying to optimise the use of the Facebook SDK. Looking at Chrome's network
Recently, I was trying to optimise this query UPDATE Analytics SET UserID = x.UserID
I'm currently trying to optimize my program. I have a large database which consists
I'm trying to optimise the performance of a string comparison operation on each string

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.