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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:30:39+00:00 2026-05-27T03:30:39+00:00

I have a Service, which is foreground. It is locally bound to one (or

  • 0

I have a Service, which is foreground. It is locally bound to one (or more) activity, so the activity and the service runs in the same process. There might be some time during which the activity is not displayed (typical music player use case).

If service and activity are in the same process, the memory for the activity can’t be repossessed by operating system, unless the service too is terminated? The answer seems yes to me, according to this article

If the last is true, should I create two separate process:

  • To be nice to the system/other apps?
  • to be more confident my service will not be killed?

Or, it is not a big deal to have the activity sticking around together with the service?

  • 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-27T03:30:39+00:00Added an answer on May 27, 2026 at 3:30 am

    I have a Service, which is foreground. It is locally bound to one (or more) activity, so the activity and the service runs in the same process. There might be some time during which the activity is not displayed (typical music player use case).

    A “typical music player use case” would not use bindService() IMHO. A foreground service would not use bindService() IMHO. At minimum, in addition to bindService() for activity->service communication, you would need startService(), so that after you unbindService() (e.g., user presses BACK), the service can stay running.

    If service and activity are in the same process, the memory for the activity can’t be repossessed by operating system, unless the service too is terminated?

    The memory for the activity is never “repossessed by the operating system”, except by terminating your entire process. Unfortunately, this is not entirely clear from the documentation.

    If the user pressed BACK to exit the activity, or you otherwise call finish() on the activity, the activity should be garbage-collected, assuming nothing is causing it to hang around (e.g., referred to by a static data member).

    should I create two separate process

    Absolutely not.

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

Sidebar

Related Questions

I have a windows service which runs continuously and creates some threads to do
I have a service which runs two asynctasks. One is for receiving multicast packets
I have an android app which runs a foreground service and while that service
I have a service which sends continously values to an activity through some custom
I have a service which has one endpoint , I have defined this endpoint
I have a service which runs on 24 hours daily.This service is started by
I have a service which monitors the activity stack to get the top activity
I have developed one application which will have activities and one background service and
I have some service which does some file processing. It may need to map
I have Activity and Service which plays music. onCreate of activity I startService and

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.