Detect wakelocks on your mobile and prevent them from draining the battery

  • Wakelocks are commands from apps that prevent the phone from going to sleep and, if misused, can significantly increase battery consumption.
  • Android offers metrics (Android vitals), battery settings, and tools like GSam or BetterBatteryStats to identify which apps are keeping the device awake.
  • Classic apps like Wakelock Detector helped to analyze CPU and screen wakelocks in detail, although many are now discontinued on modern mobile phones.
  • The best solution involves uninstalling or limiting problematic apps, using background restrictions, and adopting good programming practices to reduce unnecessary wakelocks.

How to detect if your mobile phone has wakelocks

If your phone runs out of battery much sooner than it should and you notice strange things like the screen turning on by itself or the phone always seeming to be "thinking," you most likely have a problem with active wakelocks in the backgroundIt's not witchcraft or that your phone is broken: it's apps that are preventing the system from resting when it should.

The good news is that all of this can be investigated and remedied. Throughout this article, we will see What exactly are wakelocks, how to detect them on your mobile phone, and what you can do about them. Whether you're a regular user or a developer who wants to optimize their app and avoid being penalized by Google Play for abusing them.

What is a wakelock and why does it drain your battery?

In Android, a wakelock is basically an order that an application gives to the system to prevent it from going to sleepIt is part of the operating system's own power management service and its original purpose is good: to allow certain tasks to continue running even when you turn off the screen or the device enters low power mode.

When everything is working as it should, the mobile phone periodically enters deep sleep, the maximum battery saving modeIn that state, the CPU barely works, and most processes stop or only wake up occasionally. The problem arises when an app... It misuses its wakelock privileges and keeps the CPU or screen awake. for much longer than necessary.

know apps consume android battery
Related article:
How to know which apps consume the most battery on Android

Within wakelocks, two main types can be distinguished with different effects on consumption:

  • Partial WakelockThis keeps the CPU running even when the screen is off. This is useful, for example, for an app to finish a download or process data in the background without being terminated by the system.
  • Full or Screen Wakelock (Full / Screen Wakelock): in addition to keeping the CPU active, forces the screen to stay on or turn onIt is much more aggressive in its power consumption, because the screen is one of the components that uses the most battery power.

A typical example of a poorly managed wakelock would be an app that, due to a programming error, Leave the camera or processor permanently active even if you're no longer using the application. For a while, the example of Skype on some Nexus devices was famous: the app kept camera processes running in the background, and the battery drained drastically as if you were recording video all the time.

An app requesting a wakelock isn't inherently bad. In fact, there are perfectly legitimate and beneficial uses for it. For example, YouTube keeps your screen on while you watch a video so it doesn't turn off mid-playback. The key is that the developer Release that wakelock as soon as it's no longer needed. and that it does not keep the device awake for no reason.

Typical symptoms that you have problematic wakelocks

Even if you don't see anything unusual at first glance, the phone's behavior often reveals that an app is abusing wakelocks. Some clear signs are:

  • The screen doesn't turn off when it should.You've set a short timeout, but the panel stays on much longer, even though you're not touching it.
  • The screen turns on by itselfYou take your phone out of your pocket and find it with the screen on or even performing some action on its own, such as accidental calls.
  • Very sudden battery drop while idleYou leave your phone on the table, with the screen off, and after an hour you see a disproportionate drop in battery life.
  • The device is hot even when not in use.The CPU remains active due to a partial wakelock, and the phone generates more heat even with the screen off.

These behaviors are usually due to applications that They continue running in the background and force the CPU or screen to stay awake.They are not necessarily malicious apps; often they are simply poorly programmed apps or apps that do not properly respect the energy-saving policies of the latest versions of Android.

How does Android detect wakelocks in apps (Android vitals)?

What wakelocks do to your battery and how to prevent them

From a developer's perspective, Google offers tools to detect if their app is being too aggressive with wakelocks. One of the most important is Android vitals, integrated into Google Play Console, which collects performance and battery consumption metrics from millions of real devices.

Android vitals considers that an app does a Excessive use of partial wakelocks when the sum of all non-exempt wakelocks executed by the app reaches 2 hours or more in a 24-hour period in the background or within a foreground service. In other words, if your application keeps the CPU awake for too long when the user isn't actively using it, the metric will spike.

To avoid penalizing reasonable use, Android vitals excludes certain wakelocks generated by APIs clearly initiated by the usersuch as those related to audio playback, active location, or tasks scheduled through JobScheduler. The criterion is that there is an obvious benefit for the user and that there is no better way to achieve it without wakelocks.

In the developer console, the Excessive Partial Wakelocks panel shows the names of the wakelocks that cause the most problems, the number of sessions affected, and the total durationIf more than 5% of the app's sessions in the last 28 days have excessive partial wakelocks, this may end up affecting the app's visibility on Google Play.

When an app receives this alert, the next logical step is locate which parts of the code are acquiring these wakelocks and correct their usage: replace them with more modern APIs that manage the lifecycle themselves, stop using them if they are not essential, or at least make sure to always release them on time.

Best practices with wakelocks for developers

For Android app developers, the key API here is PowerManager and its partial activation blocksA partial wakelock is normally acquired by calling acquire() with the brand PARTIAL_WAKE_LOCK, or by using other APIs that internally do the same thing.

The problem arises when the app forget to release that wakelock with release()or keeps it active longer than strictly necessary. This prevents the device from entering low-power states and results in user complaints about battery life, poor ratings on Google Play, and, as we've seen, negative vital Android metrics.

Some basic recommendations for programming with wakelocks without ruining the user's battery life are:

  • Do not use them if a modern alternative exists.Many tasks that previously required direct wakelocks can now be solved with WorkManager, JobScheduler, AlarmManager with restrictions, FCM, etc.
  • Acquire the wakelock as late as possible and release it as soon as possible.Don't leave it tied up for the entire lifecycle of a service if you only need it for a specific operation.
  • Take into account the app's statusIf the user logs off, closes the main activity, or disables certain functions, there is no point in keeping the CPU awake.
  • Monitor on real devicesAfter making changes to the code, it is advisable to verify the behavior with local wakelock debugging tools and by periodically reviewing vital Android reports.

In some cases, you'll see wakelocks attributed to your application even though you didn't explicitly create them. This is usually due to... High-level APIs that internally use wakelocks to ensure its functionality. Understanding which component is actually behind those activation blocks will help you decide whether to switch APIs or review its configuration.

How to detect wakelocks on your mobile phone as a user?

If you, as a regular user, want to find out which apps are keeping your phone awake, you have several options today. Android is increasingly offering More information on battery life and background activity monitoring directly from the system settings, but you can still go a step further with specialized tools or with ADB.

Use Android battery settings

In the latest versions of Android, the first place to look is the system battery menu. You can find this in Settings → Battery. Which apps are using the most battery and how much they're using in the backgroundAlthough it doesn't display the word "wakelock", these abnormal standby power consumptions are usually related to wake-up locks.

It is also possible restrict background usage of certain apps directly from there. This way, the system limits their activity when you're not using them, which indirectly reduces the impact of wakelocks that may be generatedHowever, excessive restriction can cause some apps to stop syncing or send notifications late.

Battery monitoring apps: GSam and BetterBatteryStats

Although many of the classic tools have disappeared or become outdated, there are still applications that They display advanced consumption information and alarm clocks.Two fairly well-known names are GSam Battery Monitor and BetterBatteryStats.

GSam Battery Monitor lets you see, among other things, Which apps are waking up the device most frequently? and how power consumption is divided between CPU, screen, mobile radio, WiFi, etc. BetterBatteryStats, very popular in the XDA community, offers very detailed views of wakelocks, "alarms" and other system events, being especially useful on rooted devices.

Thanks to these tools you can detect, for example, that A specific WhatsApp or Google Photos service is keeping the CPU awake. for backup, synchronization, or queued jobs. This information then allows you to make decisions: change backup settings, disable certain options, or even look for alternatives.

ADB command to view active wakelocks

If you don't want to rely on third-party apps or prefer a more technical approach, you can use ADB from your computer. After installing ADB and enabling USB debugging on your phone, you can run a command similar to this:

adb shell dumpsys power | findstr -i wake_lock

On Linux or macOS systems, instead of findstr it is commonly used grep to filter the outputThe command output will show the wakelocks that are currently active on the device, with names that usually correspond to system services or installed applications.

That list may include items such as DreamManagerService, WhatsApp SystemJobService or Google Photos services related to background tasks. Although the names are a bit cryptic, they allow you to identify which app is behind the resource consumption and whether it makes sense to keep the device active for so long.

Wakelock Detector: the classic app to locate wakelocks

For years, one of the most popular options for detecting wakelocks on Android was Wakelock DetectorThis application was specifically designed to list which apps were keeping the device awake and for how long. Although it's now discontinued and no longer updated for the latest Android versions, it's still interesting to understand what it offered, as many of its ideas have been adopted by other tools.

The app was designed for users who wanted See in detail which processes were using CPU and screen wakelocksIt displayed statistics of all wakelocks recorded since the last device boot, grouping those related to the same application into an expandable view for easier reading.

Among its main functions, the following stood out:

  • CPU (Partial) and screen (Full) wakelock statisticsallowing you to switch between both types from the top of the interface.
  • Sort by wakelock time, running state, or alphabeticallywhich helped to find the apps that kept the device awake the longest.
  • Currently active applications are marked in redto identify at a glance what was happening at that moment.
  • Display of the percentage of time the CPU has been awake or asleep since the last charging cycle or restart.

Its recommended use was simple: it was suggested Charge the phone above 90% and then unplug or restart it.Leave it running normally for an hour or two, then open Wakelock Detector to check which apps appear at the top of the wakelock time list. In many cases, these were the ones responsible for the battery drain while the computer was idle.

One of the sensitive points of Wakelock Detector was that, Starting with Android KitKat, it required root access to function with all the necessary permissions.This was due to changes in how the system displayed battery statistics. Its developers released a LITE version with an alternative, non-root method, based on ADB commands or even a Chrome extension, but it required following a prior setup guide.

The app gained considerable traction in the community: it was reviewed on XDA, HowToGeek, LifeHacker, DotTech, and other tech websites, and many users used it as a reference for to complement the basic consumption information offered by AndroidHowever, it's important to note that it's currently outdated and no longer maintained by its developers, so it may provide incomplete information or not even work on modern mobile phones.

Other apps and classic methods for controlling wakelocks

Besides Wakelock Detector, there were and are other tools aimed at Control which apps run in the background and how they affect battery lifeOne of the best known was Amplify, which allowed for fairly precise adjustment of the behavior of wakelocks and system alarms on rooted devices, although it is also discontinued.

Another category of apps closely related to this topic are battery saving and process management apps, such as Greenify or SD MaidThese features, which were especially useful on older devices for hibernating or freezing applications that couldn't be uninstalled, particularly bloatware or pre-installed apps, drastically reduced the likelihood of them generating continuous wakelocks. By stopping their background activity, they also reduced the possibility of them causing continuous wakelocks.

Within this ecosystem, it also appeared Wakelock Detector – Save BatteryA version focused on showing which services or processes were consuming the most energy. Its approach was simpler: It listed the system processes and their associated consumption.This was especially important due to frequent internet access and background activity. In this way, the user could immediately see if Gmail, WhatsApp, or another app was being too resource-intensive and could decide to temporarily close them if they knew they wouldn't need them.

In these cases, the philosophy behind the tool was clear: display the information and let the user decide what to do., whether it was forcing an application to stop, restricting its synchronization, or simply uninstalling it if it wasn't essential.

What to do if you detect wakelocks that drain your battery?

Once you've identified which apps are responsible for keeping your phone awake, it's time to make some decisions. The most effective solution is usually also the simplest: uninstall or disable problematic applicationsas long as they are not essential for your daily life.

If you can't or don't want to uninstall them, you can use the options Android offers in Settings → Applications → . There you'll have the option to restrict its background activity, remove permissions it doesn't need, or prevent it from starting automaticallyThese measures are usually sufficient to tame the behavior of many apps without having to delete them.

On older devices or those with aggressive customization layers, it can be useful to use tools like Greenify to hibernate apps you barely use but that constantly wake upIn some advanced cases, and always with great care, it is possible to freeze system applications that are known for certain to be unnecessary, although this already falls into the realm of users with root access and more technical knowledge.

Of course, it is worth keeping in mind that excessively restricting the activity of messaging apps, email, or backup services This can cause you to miss notifications, lose automatic syncing, or experience delays in certain tasks. It's about finding a reasonable balance between battery life and functionality.

functions and applications that drain battery on Android unnecessarily
Related article:
How to disable hidden battery-draining features on Android

Ultimately, understanding what wakelocks are and how your apps behave gives you much greater control over your phone's battery. By identifying the apps that abuse keeping the CPU or screen awake, by adjusting their settings, limiting their background activity, or replacing them with better-optimized alternativesYou can clearly extend the daily battery life of your device and avoid those mysterious drains that are so frustrating.


Save battery on Android
It may interest you:
Why an Android phone uses a lot of battery when idle
Follow us on Google News