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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:29:25+00:00 2026-06-13T02:29:25+00:00

How do I keep a service running, when all activities of an application are

  • 0

How do I keep a service running, when all activities of an application are viewable. and close the service only when I leave the app?

Is there a way to start a service in one activity of an app and stop that same service in another activity of that same application?

I don`t want that service to continue running when the user leaves the application.

  • 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-13T02:29:26+00:00Added an answer on June 13, 2026 at 2:29 am

    There is really no concept of ‘application’ and leaving it. What happens if open a link from one of your activities, launch the browser to view it, then come back via the back button? Did you really leave the app?

    What does your service do? Do activities bind to it? If so, it will be automatically shut down after the last client unbinds. If not, it should shut itself when it has finished doing it’s work (Cf. IntentService). If it doesn’t fit either of those patterns, maybe you don’t need a service at all, just some background thread(s)?

    Edit (based on comments below):

    For a service running a media player, the usual way is to have an ongoing notification for the service that lets the user bring up an activity to control the service. Or have buttons on the notification in JB to achieve something similar. Additionally, if you make the service a foreground one, that will give it higher priority and it is less likely to be killed if resources are low.

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

Sidebar

Related Questions

Is there any way to keep my background service running indefinitely even if there
A web service running in IIS but through a factory doesn't keep up the
AIR seems to keep its own DNS cache when an application is running, and
I have a C# console app that I would like to keep running, even
I want to keep my list GWT side after fetch it from service side.For
So trying to create a rest service but I keep getting an error: If
Keep running into When using the multi-mapping APIs ensure you set the splitOn param
in my android app i have an ui-update-thread that keeps all my views up-to-date.
I'm running into a crash issue while developing an iPhone app with Core Data.
I have an axis web service running in Tomcat. Clients are making connections without

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.