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
3 answers

Gps, Sensors and wake

I have a program that reads and writes all the sensors values ​​file, but when you turn off the screen stops the listener on the sensors and the record on txt file. I already tried with the wake lock, but with little success, I want to know if you…
0
votes
2 answers

Android: Should I avoid self-written methods in Commonsware's WakefulIntentservice?

In my application, I've got CommosWare's WakefulIntentservice. From the doWakefulWork method I call a couple of self-written methods. For example: @Override protected void doWakefulWork(Intent arg0) { exampleMethod(); } private void…
Xander
  • 5,487
  • 14
  • 49
  • 77
0
votes
1 answer

Android GCM : Auto waking doesn't work

Here is the code of my class GCMIntentService which is called when a notification arrived on the phone. My problem is the following : When a notification arrives on the phone, he wakes up, but then it never returns to standby mode. I think that the…
pxrb66
  • 119
  • 1
  • 1
  • 9
0
votes
1 answer

Android: Using wakelock in service triggered by alarmmanager

In my application, I've got an alarm which triggers a service which downloads information from the internet and shows a notification. Here's a simplified version of my code: MyActivity contains this: Calendar cal =…
Xander
  • 5,487
  • 14
  • 49
  • 77
0
votes
1 answer

Increase wake lock time span till my service is running in background in android

My application is running a service . What i want is that , I want screen to awake till my service running in background. I have used this PowerManager pm; PowerManager.WakeLock wakeLock; pm = (PowerManager)…
Ahmed
  • 814
  • 2
  • 19
  • 38
0
votes
1 answer

Android: What am i doing wrong? simple wake_lock code crashes on start

All I want to do is start the wake_lock with one button and end it with another. It's to use in a larger app I'm creating but this is the part I've been having trouble with. I've looked on this site and others and found the exact same codes for all…
0
votes
1 answer

Implement Wakelock

I have a Service which has two TimerTask which run on frequency of 2 minutes (set by user preference from 2 to 30 minutes.) . Now this works fine, but when the phone goes to sleep (lights off and phone under lock) this does not work as per…
Tushar Agarwal
  • 521
  • 1
  • 16
  • 39
0
votes
1 answer

Will continuous coarse LocationListener eat batteries?

I want to create an Android app which updates alarm (using AlarmManager) based on user location. As user moves 100 miles away, the alarm will be rescheduled. This app is like a scheduler app. To solve the problem, I create a location listener which…
sancho21
  • 3,511
  • 1
  • 39
  • 45
0
votes
1 answer

Using wakelock Android

I am checking the location data once every 5 mins. I have this implemented in a service which gets called every five mins. On the main activity I have two buttons to start/ stop the alarm. Is this the best place to implement the lock.. …
user340
  • 375
  • 12
  • 28
0
votes
1 answer

Android device screen doesn't turn on

I was developing an app to show videos. A BroadCastReceiver receives a AC_PPWER_CONNECTED an starts the VideoViewActivity. I can hear the sound of the Video, but the screen is off, either i want to turn it on with a wahe lock. Following Code doesn't…
AdemC
  • 406
  • 6
  • 16
0
votes
1 answer

Is it required to get a wakelock for an Android service with an active LocationListener?

In my application, I have a service that has an active LocationListener and sends the location over the air. When the service is running, the phone never goes to sleep, and it keeps sending the locations, even though I don't have a wakelock. This is…
ocroquette
  • 3,049
  • 1
  • 23
  • 26
0
votes
1 answer

Wake device from BroadcastReceiver

I have an application that sets a repeating alarm and I would like it to wake the device, unlock the keyguard, do something and then release the lock ready to repeat again on the next alarm. It seems to work but the handset only wakes and unlocks…
Scott
  • 99
  • 1
  • 11
0
votes
1 answer

How to wait for onLocationChanged() in LocationListener in the same place that invoked requestLocationUpdates()?

I'm writing a GPS tracking app. I'm using CommonsWare WakefulIntentService and AlarmReceiver to schedule fixing locations from GPS. The problem is that I must use doWakefulWork() method is meant to be used with synchronous blocking processes where…
0
votes
1 answer

Is wakelock needed in broadcast receiver for ACTION_SCREEN_OFF

I'm registering a broadcast receiver that will be activated when the screen is turned off. The receiver performs a short, synchronous operation in OnReceive. This operation must happen in my app before the device sleeps. My question: do I need to…
jamie
  • 1
0
votes
1 answer

How quickly will Android go to sleep if I stop background service

How quickly does Android go to sleep after wakelock is released? I am working on an app which uses the accelerometer in the background, and because of its high power consumption I am investigating how best to allow the device to go to sleep, at…
simekadam
  • 7,334
  • 11
  • 56
  • 79
1 2 3
35
36