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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:31:08+00:00 2026-05-23T19:31:08+00:00

I have an application that is running as a background service and constantly listens

  • 0

I have an application that is running as a background service and constantly listens to network updates (course location). The service itself doesn’t hold any wake locks. The listening part looks like this:

locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 120000, 3000F, this);

My onLocationChanged() method is doing some very simple stuff (just calculating distance to a pre-configured location using Location.distanceTo():

When looking into the battery stats, the application is a rock star – sometimes even more than the display.

CPU is not that bad but the “Stay Awake” part is very high.

Is there a way to prevent this?

I thought to use the AlarmManager to request an update every 2 minutes and then go to sleep after I get it, but I’m not sure that this is a good approach.

Also, I thought to detect when the device is in motion, but this will most probably be even a larger killer.

  • 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-23T19:31:10+00:00Added an answer on May 23, 2026 at 7:31 pm

    I think you answered your own question.

    I thought to use the AlarmManager to request an update every 2 minutes
    and then go to sleep after I get it. Not sure though that its a good
    approach.

    That would be the best approach. But don’t set it to two minutes, set it to 10 minutes intervals.

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

Sidebar

Related Questions

We have an application that has a WCF service (*.svc) running on IIS7 and
I have an Android application with a background running Service. When the Service crashes
I have an application that is currently running against a 32-bit SQL Server 2005
So I have an iPhone application running that is controlled at the highest level
I have a thread in my application that is running code that can potentially
We have a asp.net 2.0 web application that is running on IIS7. It is
I have a .NET 2.0 targeted C# windows forms application that is running fine
I have a web application that needs to fire off a long-running SQL Server
I have a c# .NET 2.0 application that has been running on W2K/IIS5 quite
I have an NSTimer running in my application that collects some data and sends

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.