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
15
votes
0 answers

How to enable wake on usb (remote wakeup) in android?

I have an AOSP tree compiled on my board. I bought a wireless keyboard and connected it to my board via usb port. I expect when the board is in the suspend state, it will wakeup by pressing a key on keyboard. But it is not so. I tried several ways…
Saleh
  • 1,819
  • 1
  • 17
  • 44
14
votes
2 answers

Put Android to sleep for testing

I'm creating an alarm app and currently have issues dealing with the Wakelock (or perhaps it's something else), to make the alarms work when the phone is asleep. However, my question isn't actually about the Wakelock, but rather about how to make…
Phil
  • 305
  • 1
  • 3
  • 13
13
votes
4 answers

Develop Alarm Application

I'd like develop an Alarm Application. The application should work like this: launch it the activity show me the time I can set the alarm I can close the application when the alarm time comes , it starts an activity (even if the device is…
vittochan
  • 635
  • 1
  • 7
  • 18
13
votes
4 answers

AlarmManager does not always execute BroadcastReceiver

So I've got a BroadcastReceiver and the AlarmManager. Let's say I create the Pending Intents like so: Intent i; i = new Intent(context, MyReceiver.class); i.setAction(MyReceiver.ACTION_1); i.addFlags(Intent.FLAG_RECEIVER_FOREGROUND); pendingIntent1…
flxapps
  • 1,066
  • 1
  • 11
  • 24
12
votes
3 answers

How to disable power button?

Is it possible to override the functionality of the android power button ? I want to 'disable' the power button. My plan is to override the functionality of this button to do nothing ( {}; ) Well my main idea is to disable the turning the screen…
Lukap
  • 31,523
  • 64
  • 157
  • 244
12
votes
3 answers

Dim screen while user inactive

I have an app which is used for lets say 4 hours, but only every 5 minutes a user needs to make an input or read the screen. Putting the phone to sleep and locking the screen is a bit annoying. So I have two…
AndyAndroid
  • 4,039
  • 14
  • 44
  • 71
12
votes
1 answer

Does a GCM-App really need a wakelock?

I'm not quite sure how to interpret this sentences in the GCM Client documentation: The android.permission.WAKE_LOCK permission so the application can keep the processor from sleeping when a message is received. Optional—use only if the app wants…
Johann Bauer
  • 2,488
  • 2
  • 26
  • 41
11
votes
6 answers

Using WakeLock to Keep A Stream Playing

I have a MediaPlayer running in a Service that's playing audio from a URL (streaming). As of now it appears to work well, and even continues playing when I put the phone in standby. I currently do not acquire a wakelock. My question is: Is it…
yydl
  • 24,284
  • 16
  • 65
  • 104
10
votes
2 answers

Incoming call listener sleeps after couple of hours

For the last couple of weeks I am facing an issue with telephony manager API in Android - listener for incoming call based on listener starting Recording and on end call stopping recording (The process working smooth) ISSUE The issue I am facing is…
Jhaman Das
  • 1,094
  • 13
  • 28
10
votes
1 answer

Android not receiving location updates when screen is locked

My app has to track the user continuously. For that I have a LocationListener which is supposed to receive location updates continuously. The issue is when the screen is turned off, it does not receive any updates. I have tried adding a partial wake…
lintu
  • 1,092
  • 11
  • 24
10
votes
3 answers

how to Notifications need WAKE_LOCK in android?

how to remove this error during download image and when Updating Notification. java.lang.SecurityException: Neither user 10080 nor current process has android.permission.WAKE_LOCK. at android.os.Parcel.readException(Parcel.java:1425) at …
AnilPatel
  • 2,356
  • 1
  • 24
  • 40
10
votes
1 answer

WakeLock under-locked GCM_LIB

My android app got crash report like below.(very rare) java.lang.RuntimeException: WakeLock under-locked GCM_LIB at android.os.PowerManager$WakeLock.release(PowerManager.java:325) at…
NoraBora
  • 333
  • 3
  • 8
9
votes
2 answers

When will android stop its cpu without wake lock?

I know android use wake lock to keep cpu running or screen on. It's obvious that screen wake lock prevents the user active timer from turning off the screen after a period of user inactivity. But I'm wondering when exactly will the cpu wake lock…
lyu
  • 588
  • 1
  • 6
  • 8
9
votes
1 answer

Wake-lock works in browser, but not as PWA

I have a web app that uses wake lock (see below) - I have registered the origin trial and added the code to my index.html. - see https://lucid-franklin-4016c2.netlify.com/ When I load the page in the latest version of Android Chrome the phone stays…
Simon H
  • 20,332
  • 14
  • 71
  • 128
9
votes
3 answers

Android - How can I wake up the phone from a hard sleep to take a picture?

I want to take pictures from the Android device's camera periodically over a matter of hours, to create a time lapse video effect. I set an Alarm Manager with an AlarmManager.RTC_WAKEUP flag set to start up a service every few minutes. The service…
Paul Klemstine
  • 281
  • 1
  • 3
  • 9
1
2
3
35 36