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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:21:51+00:00 2026-05-27T05:21:51+00:00

I am a bit confused about how services function, notably these two things: From

  • 0

I am a bit confused about how services function, notably these two things:

From http://developer.android.com/guide/topics/fundamentals/services.html :

A service is “started” when an application component (such as an activity) starts it by calling startService(). Once started, a service can run in the background indefinitely, even if the component that started it is destroyed.

and:

Caution: A service runs in the main thread of its hosting process—the service does not create its own thread and does not run in a separate process (unless you specify otherwise).

My questions:

  1. How is it possible for a service that was started by startService() survive, if the main Activity thread quits? Or only those services survive the main Activity shutdown, that are in a separate thread?

  2. How can I start a service in a separate thread? The dev doc at http://developer.android.com/guide/topics/fundamentals/services.html#ExtendingService only shows an example how to spawn a thread when the service is created…not how to spawn the service itself in a new thread…
    EDIT: Is android:process= in manifest.xml used for starting it in a separate thread? (if it starts it in a new process, then it must be in a separate thread..)

  • 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-27T05:21:52+00:00Added an answer on May 27, 2026 at 5:21 am

    To quote you,:

    Caution: A service runs in the main thread of its hosting process—the service does not create its own thread and does not run in a separate process (unless you specify otherwise).

    When the main activity is shutdown, it does not necessarily mean the hosting process exits. According to the documentation, the service continues to run because the process is alive!

    Check this

    The Android system will attempt to keep the process hosting a service around as long as the service has been started or has clients bound to it. When running low on memory and needing to kill existing processes, the priority of a process hosting the service will be the higher

    So on only when running low on resources and it is required to kill processes lying around, your process would be killed. Else. the process lives on so would your service.

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

Sidebar

Related Questions

I am bit confused about ADO.Net Data Services. Is it just meant for creating
I am a little bit confused about 2 things. Firstly when I create an
I'm little bit confused about constants naming. kName NameKey NAME_KEY Definitely usage of these
I'm a bit confused about writing queries in DQL. From the official documentation: $query
I'm a little bit confused about how Haskell dispatches to the correct function in
I am a bit confused about socket programming in C. You create a socket,
I'm a bit confused about how many controllers I need, and when I can
I'm a bit confused about inheritance under sqlalchemy, to the point where I'm not
I'm a bit confused about the use of all the IEnumerable<T> extension methods, intellisense
I'm a bit confused about how to overload the stream operators for my class

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.