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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:16:08+00:00 2026-06-18T15:16:08+00:00

I have a service in my Android application that needs to continue listening for

  • 0

I have a service in my Android application that needs to continue listening for location updates after the user has exited the application (the implications of this on battery life are a separate matter).

I’m not sure that I have correctly understood the lifecycle of a service in Android, outlined on this page:

http://developer.android.com/reference/android/app/Service.html

I believe if it returns START_STICKY in the onStart() method then the service will continue to run after the main application has quit regardless of whether or not the service is running in its own process. If the service is running in the same process as the rest of the app and I have understood correctly, the main app’s process is kept alive after the app exits, just to run that service. When the app starts again, it will run in the same process as the service, which is still running. If the system gets low on memory, Android may decide to kill this service.

Secondly, I believe it is OK to run the location listener listening for GPS updates in the same process and indeed same thread as the rest of the application and it will not block when waiting for updates from the GPS.

Have I understood correctly?

  • 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-18T15:16:10+00:00Added an answer on June 18, 2026 at 3:16 pm

    You have understood correctly.

    If the system gets low on memory, Android may decide to kill this service.

    If you want it to be persistent you can create persisitent service (but it needs to be a system app / service).

    Please use AlarmManager and an IntentService, so your service does not need to be in memory except when it is doing meaningful work. This also means Android is rather unlikely to kill your service while you are in memory, and users are unlikely to kill your service because they think you are wasting memory.

    For your location Listener:

    Use the Location Listener implemented in a service.

    Start listening the GPS when the service starts and remove the GPS listener when the service stops.

    Start this service when you wants to listen to GPS(every 10 minutes for example).

    This is cleaner than having a service you try to continuously run and checking for Location changes.

    Secondly, I believe it is OK to run the location listener listening for GPS updates in the same process and indeed same thread as the rest of the application and it will not block when waiting for updates from the GPS.

    You do not need to setup a AsyncTask or background thread for this. Also understood correctly.

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

Sidebar

Related Questions

I have an Android application that has a service that runs in the background,
I need to have ALWAYS a background service that will synchronize my Android application
I have a Web Service and an Android application that uses this web service.
I have an android application that binds itself to a remote service once the
I have a service in my android application and I need that it never
I have an Android application that has a need to perform work in the
Here's the deal: I have an Android application that needs to call a web
I have an Android service that is running and listening for microphone input. I
I have an application for android 4.0(android:minSdkVersion=14) with lots of SQLite tables that needs
I'm building a web-service for an Android application that needs to connect to a

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.