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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:54:37+00:00 2026-06-06T19:54:37+00:00

I have an android recurring service running in background, no Activity running in front

  • 0

I have an android recurring service running in background, no Activity running in front of it. Each and every 15min the Service is invoked by an AlamManager (RTC_WAKEUP) using WakeLocks to perform some network action for a cupple of seconds and then it dies. The service uses a static variable storing a PendingIntent object each time it get called. Btw: I know about SharedPreferences or using persistent layout, thats not my question.

My real question is: How could it be that my static variables are still valid? Even I the meantime of 15 min inactivity (real device sleep, does it matter anyway?) my static variables seems valid after all. I thought and read, if no Activity or Service running in the main UI-Thread and/or another worker threads the whole process dies, and the static vaules are erased, too.

If and why android keeps my process still hanging arround, keeping all static variables. An does it correlate with my scheduled AlamManager event. I daresay android keeps my process memory valid!?

  • 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-06T19:54:41+00:00Added an answer on June 6, 2026 at 7:54 pm

    How could it be that my static variables are still valid?

    Android did not terminate your process between the alarms.

    I thought and read, if no Activity or Service running in the main UI-Thread and/or another worker threads the whole process dies, and the static vaules are erased, too.

    Android can terminate your process at any time. Having no running components (activities or services) increases the odds that Android will terminate your process before it terminates other processes. However, if Android does not need the RAM, it will leave your process alone.

    However, since you don’t know whether your process will be around each time your AlarmManager event occurs, you need to handle the case where your static data members need to be initialized.

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

Sidebar

Related Questions

I have a setup where I am running a background service in Android with
I have an android application, that will call a SOAP web service for some
I have an app in android using camera with opencv which runs for about
I have a service ('Aservice') that is declared in manifest as <service android:name=.Aservice android:process=:my_process
I'm developing an Android application that consists of: a lightweight background service that logs
I have an android application that is running. After a while when user quits
I have just started using Android. I have tried an apps with orientation change.
I have a reoccurring problem with the Android Browser. This is a mobile website
I have Android pet-project DroidIn which utilizes HttpClient 4 (built into Android) to do
I have android.permission.READ_OWNER_DATA but I can't find any reliable code that would explain how

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.