I have a group of Tasker profiles that I use to conserve my battery on my rooted phone under a set of circumstances that are specific to me. However, my personal case might be useful or instructive to others, so I'm posting my profiles here.
I normally don't have Bluetooth, Location, GPS, nor Wifi enabled. If I want to use any of these services, I just manually enable them, and then disable them when I'm done.
However, my biggest battery drain comes from my device going out of cell-tower range with the phone repeatedly trying to find a signal. This happens during a significant portion of my workday, because I work in an office building in New York in which I cannot get a cell signal. Furthermore, I use the subway, and there is hardly any cell coverage underground (at least for my carrier).
Therefore, I have written a group of cooperating Tasker profiles which work as follows:
When a weak signal is detected, put the phone into Airplane Mode, during which it checks for signal strength every 5 minutes. Airplane Mode is then exited if the signal is strong enough, at which time the phone once again behaves normally w/r/t cell signal checking.
Note that this only works on a rooted phone with Secure Settings installed.
The logic goes like this:
- If my cell signal drops below a minimum strength and I'm not using Wifi, the phone goes into something which I call "WeakSignal" mode, as well as going into Airplane Mode.
- If the phone is in WeakSignal mode and Wifi is not in use, every 5 minutes it does the following:
- Exit Airplane mode
- Unset WeakSignal mode
- Check the signal strength. If it's above the minimum strength, do nothing more, which leaves both WeakSignal mode and Airplane Mode turned off.
- If the signal strength is below the minimum strength, reset WeakSignal mode and go back into Airplane mode.
This is implemented via the following profiles and tasks.
At bootup, I run a task which clears a variable called
WeakSignal, and sets a variable called
MinSignal to
2. That's the minimum signal strength that I want to accept. You can also set
MinSignal to
0 if you only want this to work if the cell signal is totally absent, and not just weak.
Profile
SigChecker0:
(runs when not in WeakSignal mode, not in Wifi mode, and when the signal strength drops below a minimum value)
Code:
Profile: SigChecker0 (6)
State: Variable Value [ Name:%WIFI Op:Doesn't Match Value:on ]
State: Variable Value [ Name:%CELLSIG Op:Maths: Less Than Value:%MinSignal ]
State: Variable Value [ Name:%WeakSignal Op:Maths: Less Than Value:1 ]
Enter: SigStrength (5) task (see below)
Profile
SigChecker1:
(runs every 5 minutes when in WeakSignal mode and when not in Wifi mode)
Code:
Profile: SigChecker1 (14)
Time: From 00:00 every 5m Till 23:59
State: Variable Value [ Name:%WIFI Op:Doesn't Match Value:on ]
State: Variable Value [ Name:%WeakSignal Op:Maths: Greater Than Value:0 ]
Enter: SigStrength (5) task (see below)
Profile
Oblivious:
(gets triggered when WeakSignal is set, which is done within the SigStrength task, below. It then turns on Airplane Mode)
Code:
Profile: Oblivious (17)
Event: Variable Set [ Variable:%WeakSignal Value:1 ]
Enter: AirplaneOn (16) task (see below)
Task
SigStrength:
Code:
SigStrength (5)
A1: Variable Clear [ Name:%WeakSignal Pattern Matching:Off ]
A2: Variable Set [ Name:%apmode To:1 Do Maths:Off Append:Off ] If [ %AIR ~ on ]
A3: Variable Set [ Name:%apmode To:1 Do Maths:Off Append:Off ] If [ %CELLSRV ~ noservice ]
A4: Variable Set [ Name:%apmode To:1 Do Maths:Off Append:Off ] If [ %CELLSRV ~ nopower ]
A5: Secure Settings [ Configuration:Airplane Mode Disabled Package:com.intangibleobject.securesettings.plugin Name:Secure Settings Timeout (Seconds):0 ] If [ %apmode Is Set ]
A6: Wait [ MS:0 Seconds:2 Minutes:0 Hours:0 Days:0 ] If [ %apmode Is Set ]
A7: Mobile Data [ Set:On ] If [ %apmode Is Set ]
A8: Variable Set [ Name:%WeakSignal To:1 Do Maths:Off Append:Off ] If [ %CELLSIG < %MinSignal ]
Task
AirplaneOn:
Code:
AirplaneOn (16)
A1: Secure Settings [ Configuration:Airplane Mode Enabled Package:com.intangibleobject.securesettings.plugin Name:Secure Settings Timeout (Seconds):0 ]
I hope this might be useful to one or more of you.
.