What are wakelocks, how they affect the battery life of your Android device, and how to "Greenify" them
Have you ever gone to bed with your phone's battery well over 50% and woken up to find out that it has depleted overnight and the device has switched itself off? There are several causes for this abnormal behavior, and among the biggest culprits are the unwanted system wakelocks.
So, what exactly are these? Wakelocks are power-managing software mechanisms, which make sure that your Android device doesn't go into deep sleep (which is the state that you should strive for), because a given app needs to use your system resources. There are several types of wakelocks:
Unfortunately, some poorly-coded, malicious, or simply buggy apps might create an abnormal amount of undesirable wakelocks. Other apps require constant Internet access in order to operate in a normal fashion - Facebook and Messenger are probably the most popular representatives. They persistently request information from the web (the so-called "polling" for new events), which is causing subsequent wakelocks.
In other cases, an update to a given app can also cause certain issues, which usually result in partial wakelocks. The latter keep your CPU constantly humming in the background, sometimes without your knowledge, and prevent your device from "going to sleep". That's a pretty substantial prerequisite for anomalous battery drain. Thus, it is advisable to regularly monitor the wakelocks on your device and see which of your apps go harsh on our system's resources.
So, we'll show you the ropes on how to do this. First, we should find out what app or process might be causing these wakelocks.
Now, after we've found out which app is causing the device to stay awake and discharge its battery at the same time, we can do several things in order to get rid of the issue. As we mentioned before, uninstalling the app is one way to do this, but let's face it - that's a pretty harsh and barbaric method, isn't it? One of the more sophisticated, yet elegant ones is by using Greenify.
This amazing little tool that allows you to put a given app in "hibernation" when you are not using it. What Greenify does is simple - it literally hides the hibernated app from the prying eyes of Android, preventing it from polling, using your hardware resources, and most importantly, causing any partial or full wakelocks. The app will only run if you open it. Neat, right?
Greenify can work on non-rooted devices, but for best results, your Android smartphone should be rooted. You'll also need a running Xposed framework if you want to make use of some of Greenify's experimental features. Note that the free version of Greenify only allows you to hibernate non-system apps, while the premium one has no such restrictions. You should know that it is not advisable to use this tool on certain system apps that you rely on or know nothing about, as this can make your system pretty unstable.
With that being said, let's see how one should put Greenify to good use!
And that's it! Don't forget to check out some of our essential tips & tricks on how to save even more of your battery's juice!
reference: Android Developers (1), (2), XDA