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

Wakelock Reference Count

Can anyone explain what this method of PowerManager.Wakelock is for? setReferenceCounted "Wake locks are reference counted by default." - why?
cody
  • 6,389
  • 15
  • 52
  • 77
0
votes
0 answers

Application is destroyed after unlocking the smart-phone

Context: I am building an app whose goal is to collect data (accelerometer for instance) during a whole day. In order to have the app active during this time and to have the screen turned off, I use the WakeLock object: wakeLock.acquire(86400000);…
Xema
  • 1,796
  • 1
  • 19
  • 28
0
votes
1 answer

how to stop a Location listener service? (not stopping now)

I am using a Location listener service to update the current location of the user for every few secs. I have also used a WakeLock to make the listener work in the background. Now everything is working fine but i am unable to stop the Location…
0
votes
1 answer

Wakelock is not releasing even after the app is force closed

I am using service class along with wakelock functionality to make the application work in the background even if the screen is off or sleep. But even if i force close the application the wakelock is not releasing and the app is working in the…
Rakesh Polo
  • 431
  • 1
  • 9
  • 27
0
votes
1 answer

Why holding PARTIAL_WAKE_LOCK causing random system crash?

I have an app holding the PARTIAL_WAKE_LOCK on startup and then releasing onDestroy. Randomly it crashes after some time 40min - 2 hours when the device is just left alone/screen is dimmed. After some investigations I found that releasing the wake…
0
votes
1 answer

Android application prevents device from locking screen and sleeping

My Android application being created by Android Studio now unintentionally prevents my Galaxy device from locking screen and sleeping. Requested permissions are following:
Spectorsky
  • 608
  • 4
  • 23
0
votes
1 answer

Aquire partial wakelock in a IntentService

My IntentService gets fired from 2 places, either by an Alarm or by the Activity and since the duration is related to the amount of data it needs do fetch from the web, from what I understood, I need to keep a partial wakelock. Here's my…
Alin
  • 14,809
  • 40
  • 129
  • 218
0
votes
1 answer

is impact of acquiring cpu wake lock increases by no of applications holding it in android?

I used this application from play store to identify the applications holding CPU locks and turned out almost entire suite of google apps along with a few third party application have acquired CPU wake locks. I am amazed that even google was using it…
Allahjane
  • 1,920
  • 3
  • 24
  • 42
0
votes
0 answers

Android Notification not fired when phone sleeps for a long time

I have a kind of weird problem. I know that I am missing something but I don't know what. I am adding approximatly 5 notifications per day that I create each two to three hours. If we have the scenario below: Notification 1 is created at 8:00 and…
user5156016
0
votes
2 answers

GPS Location tracking even when app is closed(Not running in Background)/ScreenLocked

I want to track user location very similar to strava, even after the is closed. I tried AlarmManager but it's not giving me execution after every one minute
Parvinder Singh
  • 163
  • 3
  • 11
0
votes
1 answer

Android, keep CPU on when display is turned off?

I'm at my wits end with this issue. Can't find a good solution for it! In my app I have a service within which a timer gets scheduled over and over. That means after each timerTask is executed, another is started (first, both the timer and timerTask…
Jay
  • 11
  • 4
0
votes
2 answers

IntentService - Wakelock release issue

I have an alarm application. Flow looks like this : WakefulBroadcastReceiver(Acquires wakelock) --->> Intent service -->> startActivity public class AlarmService extends IntentService { protected void onHandleIntent(Intent intent) { …
0
votes
1 answer

Wake Lock not working in android lollipop (API 21) 5.0.2

I am working with a "Call" app. I'm getting problem in releasing 'wake lock' in API 21. (It works fine with > Kitkat API but API 21). My code to start the Call activity is : Intent callIntent = new Intent(context, CallActivity.class); …
Jay Kikani
  • 29
  • 6
0
votes
2 answers

Android WakeLock not working on first run

I have implemented wakelock in my app with below code: PowerManager powerManager = (PowerManager)getSystemService(POWER_SERVICE); PowerManager.WakeLock wakeLock =…
m0j1
  • 4,067
  • 8
  • 31
  • 54
0
votes
1 answer

Android sleep mode and LocationManager

In my app the user can start a tracking service, that uses LocationManager to request location every X seconds. A user reported that on his device (Galaxy Tab S2), when the device goes it sleep mode, the tracking stops after a few minutes. I have…
Tim Autin
  • 6,043
  • 5
  • 46
  • 76