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

  • Home
  • SEARCH
  • 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 8279059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:12:48+00:00 2026-06-08T09:12:48+00:00

I would like to develop an application – a service – that updates the

  • 0

I would like to develop an application – a service – that updates the user location to server, say, every 1 hour.

I understand from the Android docs that I have to use “Android Services” and I have to do the work on the onStartCommand()

But since I need to keep sending these location updates every 1 hour, then I need to run infinite loop inside onStartCommand() … right?

Now, my questions are:

  • What will happen if system kill the service, I know my service will get started, but would it call onStartCommand() also?

  • Is there a better way to implement location update, for example, is it possible that the system call the onStartCommand() method periodically every 1 hour?

  • 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-08T09:12:49+00:00Added an answer on June 8, 2026 at 9:12 am

    AlarmManager, as mentioned by the other posts, is what you’re looking for.

    However, It’s against Android Best Practices to run things “forever, every hour” or so. If you start off by thinking “every hour, every day”, you might take actions that would harm the user’s battery life.

    Turning on gps every hour, waiting for it to acquire a lock, then turning it off, uses a lot more battery life than if you were “smarter” while checking location.

    If you do it right, e.g. setInexactRepeating, try to use WiFi location, set listeners for location update, then you can have your cake (long battery life for the user) and eat it too (still get the information you need).

    For some good tips about how to keep your app from taking up too much battery (and possibly getting uninstalled), take a look at this video from GOogle IO 2012: http://www.youtube.com/watch?v=PwC1OlJo5VM

    EDIT: Take a look at this, too:
    http://developer.android.com/reference/android/location/LocationListener.html

    You can set a listener that only gets called when the device’s location is changed. YMMV, but take a look.

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

Sidebar

Related Questions

I would like to develop a small notifications application for Windows in .NET that
I would like to develop a poker odds application that can give the probability
I'm going to write simple c++ application, server-client, client-client. I would like to develop
I would like to develop an application (that runs at all times in the
I would like to develop an application that will receive pictures from a camera
I would like to develop an application which runs as a background service .
I would like to develop an iOS application that send files between other devices
I would like to develop a mobile application that is able to access all
WE would like to develop an application to calculate road distance on server side
I would like to develop Mono application for Win/Linux/Mac in C# on Windows. Is

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.