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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:36:54+00:00 2026-06-08T03:36:54+00:00

I have an app that uses a service in the background to do some

  • 0

I have an app that uses a service in the background to do some upload/download operations.
These operations can take some time, depending on the user selection (amount and size of files).

While with my device (nexus s) and in the testing emulator, all works as planned, I am getting reports from users that the operation gets stuck sometimes when choosing to upload/download big data.

The operation is done using a thread that runs in a background service. My guess is that the OS sometimes kills the thread and/or service on devices with low memory.

In the service onStartCommand() function I am raising the thread that will do the operation (the data to handle comes within the intent), then I am returning START_NOT_STICKY.
At the activity I am using startService(i), no binding is done.

How can prevent this? How can I ensure the system will not kill either my service or 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-06-08T03:36:56+00:00Added an answer on June 8, 2026 at 3:36 am

    The use of startForeground() may help you achieving your goal.

    From docs:

    A started service can use the startForeground(int, Notification) API
    to put the service in a foreground state, where the system considers
    it to be something the user is actively aware of and thus not a
    candidate for killing when low on memory. (It is still theoretically
    possible for the service to be killed under extreme memory pressure
    from the current foreground application, but in practice this should
    not be a concern.)

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

Sidebar

Related Questions

I have an android app that uses a background service for uploading data. When
I have a small app that a client uses to manually update some data.
I have java app that uses Axis to get data from web service. web
In my MVC2 app that uses the Service - Repository pattern, how can I
Background I have a Windows service that uses various third-party DLLs to perform work
I have an app that uses a couple of SOA calls to get some
So I have an app that uses the Zend amazon web services client. I
I have an app that uses the ActionBar with tabs in combination with Fragments.
I have an app that uses webView. In the home screen of a website
I have an app that uses a transition file to flip from page to

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.