Questions tagged [wakelock]

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:

534 questions
0
votes
1 answer

How to wake up android device from sleep and play a video

I want to wake up the device and play a video. Here is my code snippet to wake up and disable key guard. pm = (PowerManager) getApplicationContext().getSystemService( Context.POWER_SERVICE); keyguardManager = (KeyguardManager)…
vidulaJ
  • 1,232
  • 1
  • 16
  • 31
0
votes
2 answers

Android screen wakeup only works with full_wake_lock

I have a service that listens to push notifications and creates an activity. Everything works well except when the device's screen is off. The desired behavior is that a notification would wake the screen up to the locked state homescreen and…
Nathaniel Wendt
  • 1,194
  • 4
  • 23
  • 49
0
votes
1 answer

getWindow() for Broadcast Receiver

I am trying to create a function to wake up my phone and unlock. For this I was using the getWindow() function, which do not work in BroadcastReceivers. How do I fix this? Any help would be appreciated! public class ShakeToWake extends…
0
votes
1 answer

I am trying to wake the android phone, using PowerManager. However, SCREEN_DIM_WAKE_LOCK seems to be deprecated

I am trying to wake the android phone, using PowerManager. However, SCREEN_DIM_WAKE_LOCK seems to be deprecated. Does anyone know how to approach this another way? public class ShakeToWake extends Activity { BroadcastReceiver…
0
votes
1 answer

Keep app alive working

I'm developing a motion detection app. This app uses the camera to compare continuosly taken frames to detect movement. So, I need the app to stay working and not being paused or stoped. I'm using WakeLock to achieve this, but I'm seeing in the…
masmic
  • 3,526
  • 11
  • 52
  • 105
0
votes
1 answer

Cannot immediately connect to the server when android device is on sleep even though my app gets the PARTIAL_WAKE_LOCK at PowerManager (Sony Xperia)

[Abstract of my android app] My app monitors the server at fixed intervals (30 seconds). [Results(Issue)] 18[h] 00[m] 00[s] server check ok. 18[h] 00[m] 30[s] server check ok. 18[h] 03[m] 14[s] server check ok. <= This is issue. My app should…
0
votes
0 answers

Excessive wake lock - How to get around this

I went to check my system and found that it had stopped. Checking the logcat I found that it was closed by Android because of an excessive wake lock issue. This is a permanently powered embedded device and I need the application to be always running…
0
votes
0 answers

Turn the screen in to totally dark when press the button on the screen

How to code the android to turn the screen completely off just like you press the power button to lock your screen. I want the user to press the button on the screen and then screen goes off. I have tried (with permission): PowerManager.WakeLock wl…
Ricky Zheng
  • 1,279
  • 3
  • 16
  • 27
0
votes
1 answer

Sensor Background Service wakelock

I am working on an app that runs a background services which reads accelerometer (and also sometimes, gyroscope) data in the background continuously. I use partial wake lock but there's battery drain. Is there any way I can reduce or minimize the…
0
votes
2 answers

Acquire wake lock, release it and acquire it again while the phone is sleeping

I think this is pretty much the standard case already described in other SO question but I still need a clarification on this matter: So I have an Android app with an Actvity and a Service. The Activity is not of interest but the Service. The…
Anton Sarov
  • 3,712
  • 3
  • 31
  • 48
0
votes
2 answers

Android Background Service with PARTIAL_WAKE_LOCK

So... I have a service that spawns a thread that is listening to data from a device via the device's wifi network. All works well, except that the service seems to pause when the the device is put to sleep. I've tried PARTIAL_WAKE_LOCK and WIFI_LOCK…
KMLong
  • 8,345
  • 2
  • 16
  • 19
0
votes
1 answer

Acquire WakeLock in Service

I am making one android application where I am calling WebAPI in background in service. So Do I need to acquire wake lock there to execute http request ?? Second case :: Here in second WebAPI where I need to upload photo/vidoes then do I need to…
Mick
  • 1,179
  • 5
  • 14
  • 24
0
votes
2 answers

Wake lock for Mac OS X

In Android, there's wake lock to keep the screen on. So, is there Mac equivalent to keep the screen on for a PC running Mac OS X? If that is the case, what are the APIs?
dacongy
  • 2,504
  • 3
  • 30
  • 48
0
votes
1 answer

What actions can be performed when an android device is in sleep mode?

I am currently working on an application which requires a service running in the background to play music when the phone is in sleep mode. I would like to know what are the actions that can be performed to trigger play music action while the device…
0
votes
1 answer

android broadcasts and wake locks synchronization

I have a service A, which is started by WakefulBroadcastReciever from AlarmManager. Service A follows a standard pattern - performs a computation, then sends local broadcast to inform the system about the results, then calls…