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

ADB wifi unreachable when it looses connection in device with wake lock (CPU only)?

I am using wake lock on my Nexus 4 to force it to stay awake (I am using wake lock with CPU only option). However, after sometime, ADB wifi looses connecting and I am unable to reconnect to it again unless I turn the screen back on. Does anyone know…
22332112
  • 2,337
  • 5
  • 21
  • 42
0
votes
2 answers

wake lock fails to keep app going

I want the sound to play in my app when the screen times out or the user presses the power button to cut the screen off. @Override public void onCreate(Bundle savedInstanceState) { PowerManager pm = (PowerManager)…
user2727048
  • 115
  • 2
  • 12
0
votes
1 answer

Using a wake lock

I have a sleep machine app that I want to still play the sound if the phone goes into stand by. I just edited to have the wake lock added and it is added in the manifest as well. It isnt working correctly but I am not sure why. package…
user2727048
  • 115
  • 2
  • 12
0
votes
1 answer

ON_AFTER_RELEASE-flag doesn't work consistently

After I'm releasing my WakeLock, I want the screen to stay on for the duration of the user's display timeout system setting, which is what I believe the ON_AFTER_RELEASE-flag does. It works fine on my device (GNex, 4.3), but a lot of my users…
Nick
  • 3,504
  • 2
  • 39
  • 78
0
votes
1 answer

Switch on screen and let default display timeout take over?

I'd like to switch on the screen from a service and immediately let the default system timeout take over (i.e. not hold a wakelock for a specific time, but just hand over control to the system). I've tried WakeLock.acquire() followed immediately by…
Nick
  • 3,504
  • 2
  • 39
  • 78
0
votes
0 answers

Wake Lock error when change activity

Wake Lock works fine in the first activity but when the user press the button for change activity the app crash...Why? I used wl.release(); Also i used permission WakeLock in the manifest.Also i had registered the activity 2 in the manifest. private…
user2342687
  • 227
  • 1
  • 6
  • 17
0
votes
1 answer

Why doesn't my wake_lock work?

I wanted a timer and I found that it didn't work when the device went to sleep. I had used AlarmManager but it doesn't work. I also tried service which was still not helpful. Then I tried WakeLock with partial_wake_lock. It worked well at the very…
水云逸
  • 1
  • 2
0
votes
1 answer

Questions regarding Using AlarmManager with locked screen

So I basically know how to use AlarmManager and unlock the screen and key guard to run the activity . Here is the code i am using PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); PowerManager.WakeLock wl =…
Hassan Jalil
  • 1,114
  • 4
  • 14
  • 34
0
votes
1 answer

Android WakeLock vs. Timer

I am trying to complete an android application where the phone will start off awake, attempt to gather a sample from a sensor via NFC, go to sleep, wake up, and repeat. If no sample is gathered (i.e. the sensor runs out of battery life) the…
Steve
  • 55
  • 2
  • 6
0
votes
1 answer

Android Lock Screen App Widget: how to wake up the device (and send it back to sleep again after)

Hi and thanks for your help. I have the following situation. I have a Lock Screen Widget, when the user taps it the App Widget perform some tasks (updates itself). The point is that: if the phone is in sleep mode and the user taps the App Widget,…
Lisa Anne
  • 4,482
  • 17
  • 83
  • 157
0
votes
0 answers

Different between insert cable and without cable?

On My Activity , i start a service to register a broadcast receiver for receiving event screen off. I want when screen off , my activity will auto start. Code on onReceive() of receiver : public void onReceive(Context ct, Intent intent) { if…
CauCuKien
  • 351
  • 1
  • 2
  • 12
0
votes
1 answer

Does Android's standard mail app run using AlarmManager

When an Android device receives mail, does it do this by periodically connecting to the mail server? When the device is in standby mode where the screen is off, I assume that the standard mail app also is shut down but possibly uses the AlarmManager…
Johann
  • 27,536
  • 39
  • 165
  • 279
0
votes
1 answer

How WakeLock works in general? For me it does not work

Can anyone describe or point me to a good description to "how wakelock in android works"? You can forget Android standard documentation for it. I have a service (started as foreground) and in the service an own thread will be started. The thread…
valerian
  • 23
  • 6
0
votes
1 answer

GCM Acquiring wakelock

I'm using GCM to send notifications, everything work correctly. I tried to create a GCM library, so I can integrate GCM in my future android apps easily. I created a project containing everything I need to show the notifications, and mark it as a…
0
votes
1 answer

Does Android have a means of storing an app's state to disk

I would like to perform a wakelock at certain time intervals in my app. It would be nice if Android could just store the entire state of my app to disk prior to the wakelock being released and then reloaded when an AlarmManager alarm or some other…
Johann
  • 27,536
  • 39
  • 165
  • 279