Questions tagged [android-wake-lock]

Refers to PowerManager.WakeLock, a class from the Android SDK belonging to package android.os. Its responsibility is requesting CPU resources in the context of power management. If no wake locks are taken, Android will shut down the CPU.

The Android Operating System uses its own power management scheme, built on top of the standard Linux one. Since it's mobile-oriented, one of its main goals is to avoid wasting CPU cycles (i.e. power) if no application is running.

That's why every application must request CPU resources, using wake locks. If no wake lock is taken, Android will shut down the CPU in order to save power.

Resources:

366 questions
0
votes
1 answer

Location of android wakelock c code for android, or hardware/power.h file

I'm trying to implement wakelock in C/cpp.. I assume there's a bit of c code that sits under the java call, and when I look at the wakelock in the com_android_server_power_PowerManagerService, I see what looks like a good bit of code.. But it of…
MollyCat
  • 485
  • 1
  • 6
  • 14
0
votes
1 answer

Android WakeLocks not working

Right at the acquire() it fails. Eclipse doesn't say what the error was. It just stops the execution on my emulator and gives me that "Class File Editor" "Source not found" display. public class MyAppActivity extends Activity { private…
Joe C
  • 2,728
  • 4
  • 30
  • 38
0
votes
1 answer

Can an android process run while screen is locked without WAKE_LOCK?

Is WAKE_LOCK the only solution to a background service that is only active when a specific event occurs?
user2513955
0
votes
3 answers

Partial wake lock not working

I wrote this code to make my activity wake if screen is off. private PowerManager mPM; private PowerManager.WakeLock mPartialWakeLock; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle…
ARM
  • 363
  • 1
  • 7
  • 18
0
votes
1 answer

Android System Services not available error

I want to try to use system service such as wakelock but for some reason when i run it errors saying "System Services not available to Activities before onCreate()" I tried changing a little of the wakelock to see if it would fix it by moving the…
user2253722
  • 25
  • 1
  • 9
0
votes
1 answer

Is there a way to find programmatically what application holds you mobile awake after screen is OFF?

Is there a way to find programmatically what application holds you mobile awake after screen is OFF? I need to detect what application holds awake, to make some statistics for the user? For example on Feb 11, 13:44 app X holds awake for 20 minutes.…
Alex
  • 239
  • 5
  • 12
0
votes
1 answer

onActivityResult() is not called when acquiring wakelock globally and setResult() defined in handler.postDelayed() block

I have some code that gets executed when the screen is on, but when I power off the screen, has some problems in execution(even after acquiring Wakelock globally). I have a service that acquired a wakelock and calls the activity - ExecuteScript with…
0
votes
2 answers

PARTIAL_WAKE_LOCK kills my mediaplayer

I implemented a wakelock to avoid stopping my MediaPlayer (playing local files only) when screen goes off. Since I don't want to drain battery, I tried a PARTIAL_WAKE_LOCK. But it has no effect: screen off kills my player. FULL_WAKE_LOCK works fine,…
Luis A. Florit
  • 2,169
  • 1
  • 33
  • 58
0
votes
1 answer

If a full wake lock is enabled does the wakelock automatically get released when the device is locked

I am working on an android project where I am using PowerManager.FULL_WAKE_LOCK to make sure the screen stays on at all times. I was wondering if the user locks the device while the wake lock has been aquired whether the wakelock will automatically…
Boardy
  • 35,417
  • 104
  • 256
  • 447
0
votes
1 answer

System Wide Wake Lock and release depending on power connection

I am trying to work on a simple android app that when the device is plugged in, i.e. via a dock, the screen aquires a wake lock so that the screen does not turn off, no matter what app their in, and when unplugged the wake lock is released. At the…
Boardy
  • 35,417
  • 104
  • 256
  • 447
0
votes
1 answer

How to handle continuos recording of user geo-points in Android even with screen off?

I have an app which is recording the position of the user continuously. The location updates are to be very frequent to get an exact mapping of the route the user has taken. To keep the application recording the geo points when the phone falls…
span
  • 5,405
  • 9
  • 57
  • 115
0
votes
1 answer

Android: What am i doing wrong? simple wake_lock code crashes on start

All I want to do is start the wake_lock with one button and end it with another. It's to use in a larger app I'm creating but this is the part I've been having trouble with. I've looked on this site and others and found the exact same codes for all…
0
votes
1 answer

Wake Locking while running a service

I am wondering simply is this the correct way to implement a Wake Lock to make my device come back on after it has been in sleep mode. After the device is back on it will then launch an intent from that point. Really I just want to make the screen…
CodeMonkeyAlx
  • 813
  • 4
  • 16
  • 32
0
votes
1 answer

Switch on the screen of emulator

I'm implementing my own alarm clock and want to take care about situations when it's time to alarm and display of my emulator is switched off. I'm trying to handle it with the following code in onCreate() of my activity that pops up when it's time…
Dmitry
  • 85
  • 10
0
votes
2 answers

Achieve Partial wakelock inside asyncTask Class

I have an application that runs a long process. I am using AsyncTask class to achieve it. But when the phone sleeps the async task automatically stops. To stop this behaviour I want to achieve a partial wakelock when the doInBackgound starts and…
user1589754
  • 647
  • 2
  • 8
  • 20
1 2 3
24
25