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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:43:24+00:00 2026-06-04T15:43:24+00:00

In my application i have a service created in a different thread than the

  • 0

In my application i have a service created in a different thread than the main one (UI).
Then, in the service, i created 3 others threads that execute in background indefinitely.
But as soon as the phone goes in standby mode, these threads suspend their execution!

If i connect the phone to the pc via usb cable, instead, i see that the threads work properly, without suspending themeselves even when in standby mode.

But how to do not let threads have this behaviour in normal execution?

tnx

SOLVED:

I managed to get this simply by using the PowerManager object, which acquire a PARTIAL_WAKE_LOCK that leave the cpu active from the acquire() to the release().

PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
 PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "My Tag");
 wl.acquire();
   ..CPU will stay on during this section..
 wl.release();
  • 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-04T15:43:25+00:00Added an answer on June 4, 2026 at 3:43 pm

    I managed to get this simply by using the PowerManager object, which acquire a PARTIAL_WAKE_LOCK that leave the cpu active from the acquire() invocation till the release() invocation.

    In this way even if phone goes in stanbdy mode, thread is sure to be running.

    PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
     PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "My Tag");
     wl.acquire();
       ..CPU will stay on during this section..
     wl.release();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a service application that host several WCF endpoints through different bindings. I
We have created a WCF RESTful service for a WPF(UI) Application. The UI sends
I have two windows application, one is a windows service which create EventWaitHandle and
I have an service application that reads a config file containing a list of
I have a service that spawns a WPF application process when a user logs
I've created a graphing application that calls a web service. The user can zoom
We have an application in which we have created a service layer with most
in my C#-Silverlight-3-Application, I have created a class, that is doing some calculations that
I have a windows service that has been running. I have created a new
I have created a C# application that I want to split into server and

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.