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

Android app high CPU usage, no services or wakelocks

I've forked the system messaging app and it is consuming the majority of my CPU, and others have reported the same. I cannot for the life of me determine why. I figured the drainage could be possibly two things (because of how much it is draining):…
mtbrock
  • 96
  • 7
0
votes
1 answer

MediaPlayer lagging on phone lock

I have an app that plays sounds on button press. These sounds loop continuously and are between 10-20 seconds long. Everything works exactly as it should, however whenever I lock my phone by pressing the power button (lock button), the MediaPlayer…
rossd
  • 229
  • 1
  • 3
  • 14
0
votes
0 answers

AlarmManager is keeping my device awake for hours

I have an application which has to execute every days at 00:00, so I have used AlarmManager to set alarms. This is the class I use to set an alarm: package bembibre.coolstar.windowsmobilewidget.backend.alarms; import java.util.Calendar; import…
user3289695
  • 740
  • 1
  • 9
  • 20
0
votes
1 answer

NotificationListenerService and keeping device awake during work

I'm extending the NotificationListenerService in order to catch notifications being posted to the device. This has been working perfectly fine without doing anything special (like using wakelocks). I used to use a background thread to do some work…
0
votes
1 answer

How to acquire a Partial wakelock on Deep sleep

Is there any way we can acquire a Partial wacklock when the device goes into a deep sleep mode without triggering a screen ON? Acquiring the wakelock seems to work only if the device is awake (screen Off). I need to keep the screen Off. Edit: I'm…
wanam
  • 548
  • 4
  • 8
0
votes
0 answers

Does NotificationManager require wake lock in order to publish notifications immediately?

In my app, I need to notify the user right after an event (i.e. geofence transition or arriving push message). By notifying I mean posting a system notification with vibration, sound and LED flashing, Curently, I am posting a notification via…
0
votes
0 answers

Using WakeLock versus AlarmTimer in 10 hour background service

I have a background service that runs for a period of about 10 hours. During this period it acquires information from one of the phone's sensors (about 300 TIMES PER SECOND), processes the information, and uploads the processed information to a…
0
votes
1 answer

Android - Alarm with Wakelock not launching Service from intent

I am writing an app and am having a bit of trouble with getting my Alarm BroadcastReceiver from starting a desired intent. The code is as follows: public void onReceive(Context context, Intent intent) { Log.d("Alarm:","Running WakeLock"); …
PaX
  • 45
  • 6
0
votes
1 answer

Wakelock not keeping CPU running

My app - reads a text file with scanner containing mobile nos and message for each. Sends SMS to each mobile nos as per the text file. Each time no of SMS varies from 20 to 140nos which takes about 8 to 10 minutes. If I keep the CPU running by…
Madiya
  • 23
  • 5
0
votes
0 answers

Preventing lock screen from showing on wake-up?

I'm building an alarm app. I have it so a broadcastreceiver acquires a wakelock and starts the alarm activity. These are the flags I'm using: Wakelock: PowerManager pm = (PowerManager) ctx.getSystemService(Context.POWER_SERVICE); WakeLock wakeLock =…
Huy T
  • 1,273
  • 1
  • 11
  • 21
0
votes
1 answer

android using TimerTask and execute when screen is off

In my app I want some action to be executed on specific time (not delay). I've come to use TimerTask, which works fine as long as the screen is ON. I've read in some places I have to use wakelock to get it work while screen is OFF. Everywhere it is…
SagiLow
  • 5,721
  • 9
  • 60
  • 115
0
votes
0 answers

Android app slowdown despite wakelock on USB disconnection

I am making an application that does some audio processing and plays it back in real time. The issue I'm facing is that the application works just fine when the phone is connected to the computer with a USB cable, but the audio starts to skip and…
Anuj Jain
  • 315
  • 1
  • 15
0
votes
1 answer

android service not defining layout

I have made this service to play a sound, I could be way off base with what I created because I was following a simple tutorial that was not even close to what I tried to do. in any case I have it set on my main activity that when the button is…
user2869238
  • 77
  • 1
  • 1
  • 8
0
votes
1 answer

BroadcastReceiver not firing when phone is sleeping

I have a app that takes care of certain silence functions, but I can't make it work when the phone is sleeping and not connected to the computer. Everything works fine when the screen is on, but it stops working when the phone sleeps. Any idea what…
Reaver
  • 323
  • 3
  • 21
0
votes
2 answers

wake lock does not work

I have posted this question before and no one could answer it so I am trying again as this issue makes my app worthless. I need the sound to keep playing when the screen times out or the user taps the power button. I have read almost every online…
user2727048
  • 115
  • 2
  • 12