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

Calling WakefulIntentService.sendWakefulWork causes runtimeexception

When this code is run, it gives me a exception RuntimeException. I have yet to add any code to the WakeWork.class. Any thoughts on why this is bombing out? THIS IS CALLED FROM MY 'ON RECEIVER' ALARM. Intent i = new Intent(context,…
iBoston
  • 69
  • 1
  • 9
0
votes
0 answers

GPS not getting enabled after smartphone is in a long sleep

My app is designed to record a GPS location about once every 30 minutes. This is done as a background service and I also include a wake lock to keep the app running even when the screen goes off or when the user presses the power button to go into…
Johann
  • 27,536
  • 39
  • 165
  • 279
0
votes
1 answer

AlarmManager working well in emulator but not in real device

this is my code for setting alarm: public void SetAlarm(Context context, int tag, long time){ AlarmManager am=(AlarmManager)context.getSystemService(Context.ALARM_SERVICE); Intent i = new Intent(context, Alarm.class); …
Shoshi
  • 2,254
  • 1
  • 29
  • 43
0
votes
1 answer

Battery performance using wakelocks

my app uses the commonsware wakeful pattern to wake the device up at a frequent (5 minute) repeating alarm interval. I know waking this frequently maybe the root of my problem, but the actual work done when the device wakes up is minimal and the…
Dom
  • 177
  • 1
  • 6
0
votes
5 answers

android - keeping a wake lock through an orientation change?

I'm trying to create an application that would stay awake as long as the user chooses it to - and it would even stay awake in the case of an orientation change. Initially I did this by creating a wake lock when the user decides that the application…
Ákos Maróy
  • 919
  • 2
  • 10
  • 19
0
votes
1 answer

httpclient sleeps while executing

I am developing long running application, my application uses DefaultHttpClient (I also tried with AndroidHttpClient) periodically. I don't know but after working a while, somehow httpClient.execute sleeps. Literally sleeps, when I wake(unlock or…
guness
  • 6,336
  • 7
  • 59
  • 88
0
votes
3 answers

Why do WakefulIntentService check START_FLAG_REDELIVERY?

In WakefileIntentService.java from the CWAC Wakeful library the code contains: @Override public int onStartCommand(Intent intent, int flags, int startId) { PowerManager.WakeLock lock = getLock(this.getApplicationContext()); if…
0
votes
1 answer

The difference of wakelock core code and interfaces in kernel 3.0 from 3.7/3.8?

I was told that wakelock in kernel 3.7/3.8 is different from 3.0. What has changed and is there any document or discussion somewhere talking about this? Thanks!
user1804788
  • 187
  • 1
  • 3
  • 12
0
votes
0 answers

Application crashes with wake lock and power manager

I create an application for use flash LED android as torch or as strobe light and add wake lock and power manager for not sleep.But when the user go to menu setup my apk crashed.Without wake lock work fine!How i fix it? private PowerManager.WakeLock…
Antonis Kan
  • 55
  • 1
  • 9
0
votes
1 answer

Set time for the screen to stay on

I already know where to begin, at least by WakeLock class, but I can only call methods on and off the screen ... I do not know the simplest way to terminate a while for the screen to begin start off .. (brightness decreases slightly before turning…
Artur Couto
  • 498
  • 1
  • 6
  • 19
0
votes
1 answer

Android WifiLock not working?

I need to pull data from a server on the local network every x minutes via WiFi and HTTP. A Service is running in the Background and I use an AlarmManager to trigger the query. Wifi Sleep Policy is set to "never" on the device. Problem is, the…
Philipp E.
  • 3,296
  • 3
  • 34
  • 52
0
votes
4 answers

What vertical bar('|') means in android?

For example: WakeLock wakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK| PowerManager.ACQUIRE_CAUSES_WAKEUP|PowerManager.ON_AFTER_RELEASE, "Alarm"); What does the ' | ' character mean? More details about the problem: I'm…
Rafael Ito
  • 37
  • 5
0
votes
1 answer

use internet connection continuously in android

i have a chat application.my code has a thread which manages internet connection. but after some minutes my thread goes sleep. I know i should use WakeLock to wake CPU and my thread. but when i use below code , battery usage goes up. if (mWakeLock…
M.Movaffagh
  • 1,284
  • 5
  • 20
  • 33
0
votes
2 answers

Unable to Keep Screen from Sleeping in Android 4.2

I have a simple battery test app I wrote for Android and have used for several versions now successfully. It works fine in Android 4.1 The app simply launches the chrome browser to a different web site, logs the time to a database, waits 60 seconds…
user1850261
  • 105
  • 1
  • 7
0
votes
1 answer

WakeLock in Google cloud messaging

I am learning GCM through the following tutorial, Android Developer Guide. There is such line "your application must acquire a wake lock before starting the service—otherwise the device could be put to sleep before the service is started." In the…
Blake
  • 7,367
  • 19
  • 54
  • 80