So far in our Android customization series we have used tools to build designs and control your device with a reckless disregard for your battery life, we better do something about that. While battery life is an important topic for most Android users, it is very involved and will require that we look at it from a few different angles.
We will look at three aspects of your device today: WiFi, Bluetooth and Background Sync.
Before we get started
Most of us step outside the house during our normal day, even if only to run to work or school, it is times like these that WiFi is probably not required. Unfortunately, Android is designed such that if WiFi is enabled, the device will scan for available WiFi networks, this can be brutal on battery life, so we best just turn off WiFi when we head out our front door.
If you followed along a while back, we actually already built a Tasker project to toggle on and off WiFi on your device. At that time, we used an element within a Zooper Widget to trigger the action.
If you are unfamiliar or uncomfortable with Tasker, follow along the Zooper Widget tutorial to build your Task. For those that know what they are doing, the Task is simple:
Net -> WiFi -> Off.
With the explosion of Bluetooth connected smartwatches out there these days, you may never want to turn off your Bluetooth, but if you do not have Android Wear on your wrist, chances are you only use Bluetooth for specific tasks. If you are like me, you don’t mind manually turning on Bluetooth as needed, but you always forget to turn it back off. Tasker to the rescue.
Head into the Tasks tab of Tasker and start a new Task.
Name it uniquely and concisely, I’ll call mine “KillBlue“.
Tap the “+” button to add a new action.
You can leave the settings as they are, Set as Off, and hit the system Back button to save and exit.
It is extremely convenient that our Android devices are always connected, always checking for new emails and social media notifications and so much more, but this takes its toll on your battery. If you know you will not be checking messages for a time and want to save some juice, we can just turn off background sync.
You can always handle this manually through your system settings, but we like to automate with Tasker.
Create a new Task and name it uniquely and concisely, I’ll call mine “NoSyncing“.
Tap the “+” button to add a new action.
Leave it Set to Off and hit the system Back button to save and exit.
When do we use these Tasks?
The true power of this project is deciding when to trigger these Tasks. For each of us, the answer will differ, some of us can kill WiFi and fire up Bluetooth when we connect to the dock in our car, some of us will use Location services to decide, and for many, today’s actions can be controlled based on the time of day. Let’s look at what a time based Profile might look like.
Don’t forget that we’ve already created a Sleep and Silent mode using Tasker, feel free to reference that for better instruction.
Navigate to the Profiles tab in Tasker and start a new Profile.
Choose Time and set your typical sleep hours. Perhaps you would like to set it for an hour or two after you normally go to sleep and an hour or two before you wake up, this way you do not miss anything, but your device still gets a few hours of down time.
Hit the system Back button to confirm and exit.
Choose your “WiFiOff” Task.
If you find that WiFi does not turn back on when the Profile finishes, create a new Task that turns WiFi back on and set it in the Profile’s Exit Task. We covered Exit Tasks here.
Using this same concept, you can create more Profiles to cover other times of your day. You could set WiFi to turn off during working hours, if you don’t have WiFi at the office, or whatever suits your needs.
One of the best ways to control Background Sync is to put it on a schedule.
Create a new Profile in Tasker and again choose the Time option.
When choosing your time, turn off From and Until, instead activate Repeat and set it to, say, 2 Hours.
Tap the system Back button to confirm and exit.
Choose your “NoSyncing” Task.
To make this work properly, we will need to modify our “NoSyncing” Task to have four actions. And we get to learn about IF conditional statements.
Action 1: Tap the “+” button to create a new action, choose Task, then choose Stop.
Tap the “+” beside If.
Tap the little label icon and scroll down the list to find and tap on WiFi Status.
Tap the ~ and choose Doesn’t Equal.
In the last field, type “on“, without the quotes.
Tap the system Back button to save and exit.
Action 2: Create an action that turns Background Sync on.
Net -> Auto-Sync -> Set On
Action 3: We must pause for a few minutes to let the Background Sync do its thing.
Tap the “+” button to create a new action, choose Task, then choose Wait.
Set a time value, I’ve gone with 5 minutes, which should be enough time for everything to sync. Tap the system Back button to confirm and exit.
Action 4: Turn Background Sync back off. You should already have this action in your “NoSyncing” Task, you can re-arrange the actions by tapping and dragging from the far right edge in the list.
As I am sure you see now, every two hours your system will try to check for messages. With the Stop action in place, Background Sync will only be activated if WiFi is turned on, otherwise it simply exits the Task and waits for next time.
I feel bad that today’s items only just scratched the surface of all of things that can be done to reduce battery consumption. Rest assured I will have more ideas, tools, tips and tricks coming, some will involve Tasker, but not all, and we will dive into some of the extras one can do with a rooted device.
Please spend some time and play with your WiFi, Bluetooth and Background Syncing needs in Tasker; as mentioned, you can turn each of these on and off based on location, time, availability of specific WiFi networks and Bluetooth devices and so much more. A quick word of warning, however, using location services, especially GPS, can sometimes actually use more power than you are trying to save.
We will continue with battery saving techniques next week on our Android customization series, perhaps we will take a look at those location services I just mentioned. With recent changes to the Android operating system itself, Tasker needs a little boost to be able to turn on and off GPS directly, we’ll take a look at how that works.
How do you like to manage your WiFi, Bluetooth and Background Sync settings?