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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:47:34+00:00 2026-05-31T06:47:34+00:00

I have an Activity that starts a service. When the activity is closed, I

  • 0

I have an Activity that starts a service. When the activity is closed, I want the service to continue running in the background. I have a couple of questions here.

Will closing the activity screen cause the activity to actually stop? Or do I need to forcibly stop it to cause it to stop?

If closing the screen does cause it to stop, then I assume I need to use startService to start it. Is that correct? If that is the case, is there a way to get a handle to the running service next time the activity starts? If it is not the case, then I can just bind to 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-31T06:47:37+00:00Added an answer on May 31, 2026 at 6:47 am

    When your Activity is no longer visible on the screen, it is stopped. Stopping an Activity bound to a Service does not stop the Service. However, you’ll want to make sure you unbind from the Service when your Activity calls onDestroy() to make sure you don’t have any dangling handlers and suchlike.

    You can rebind to a running Service the same way as you did the first time. Sending an Intent to start a Service that’s already running doesn’t create a second instance of it, so that’s safe.

    A good way to start a Service like you’re describing is to start it using the Context.BIND_AUTO_CREATE argument to your call to bindService().

    The details of all of this can be found at the Android docs about bound services. It can be a little confusing at first. Follow the tutorial code closely since it sounds like your problem maps well onto the sample they provide.

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

Sidebar

Related Questions

I have an activity that starts a long-running service which in turn adds an
I have an single Activity application that starts a Service and binds to it.
So i have a service, that starts an activity displayed as a Popup thank's
I have an Activity with a button that starts a long running task. I
I have an Activity that starts and binds to a Service . I then
I have an Activity that starts a Service. In my Activity: startService(new Intent(this, MyService.class));
I have an activity that starts a service. There is also a singleton Data
I do have one service running in the background. Whenever it starts I store
I have an activity that starts a service like that: Intent youtubeIntent = new
So I have an activity in an application that starts a service: private void

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.