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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:50:18+00:00 2026-06-13T22:50:18+00:00

I have an application that implements a remote background service. This service is implemented

  • 0

I have an application that implements a remote background service. This service is implemented to download files in threads (I would say this service works as a download manager).

When I want to download a file, I send the url to the service, and the service starts a thread (I was using AsyncTask but it only worked in Android 4.1) where it actually downloads the file. But sooner or later the download stops, and I was able to know that because the notification I show doesn’t get updated anymore. When I click the notification to cancel the download, a pending intent is sent to the service to tell it to cancel the download, but not download is cancelled as the service is re-created (onCreate gets called).

Edit: Forgot to say that I return START_STICKY in onStartCommand()

What solutions do I have? Any way to avoid the service getting killed?

I was looking also into startForeground(), and that would be ok if the service target is to download only one file but I want support to download multiple file simultaneously.

Thank you.

  • 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-13T22:50:19+00:00Added an answer on June 13, 2026 at 10:50 pm

    About the only way to prevent your service from being killed is to use startForeground(). Even this won’t guarantee that Android won’t kill your service, but there isn’t anything better. We’ve had good success using foreground services.

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

Sidebar

Related Questions

I have to write an application that implements a secure connection between client and
I made an application and i have in it a FrameLayout that implements an
I have implemented an application using jQuery on PhoneGap. In that I'm using a
We have a vb.net application where we have implemented multithreading. We determined that we
I have an application that goes like this F5 load balancer - IHS(a&b) -
I have an Enterprise Application with an EJB implementing a @Remote business interface that
in this application i am running a remote service where i am starting a
I have an application that implements something like a Chain of Responsibility in Python.
My scenario is the following: I have a remote service with which any application
I have application that makes different queries with different results so the caching in

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.