Would really appreciate some help making a wifi/cellular Tasker script :) - Android Q&A, Help & Troubleshooting

Hi there,
I recently rooted my Google Pixel XL (8.1 Oreo) and have been working hard to optimise it much as possible.
I noticed in my battery stats that "Mobile Network Standby" has taken about 60% of the usage since my last charge so I thought I'd make a nifty Tasker script to toggle it on and off when needed. I've done a little programming in the past and have tried to write the commands as simply as possible in a way I can comprehend.
What I've come here for is to see if anyone would be kind enough to convert this into Tasker's syntax, or to perhaps give me some pointers on doing it myself.
I also have a question regarding what "Mobile Network Standby" refers to specifically. Would simply turning off Mobile Data fix this? Or would I need to go flight mode to fully disable it connecting to the towers? I've heard it's maintaining the connection that takes most of the battery, rather than the data itself.
So here's the code. The idea is that when I use my phone I always want an internet connection but also have the cellular off as often as possible. Wifi obviously takes priority, locking the phone for longer than 90 seconds turns off cellular, and after that it should turn on every 5 minutes for 15 seconds so I'm still getting Messenger notifications.
If (wifi connects) then
Turn off cellular
EndIf
If (wifi discons >15 secs) and (locked <90 secs) then
Turn on cellular
EndIf
If (screen turns off for >90 secs) then
Turn off cellular
EndIf
If (phone unlocks) and (no wifi) then
Turn on cellular
EndIf
If (not unlocked for 300 seconds) and (no wifi) then
Turn on cellular
Sleep (15 seconds)
Turn off cellular
EndIf
Thanks for your help guys, I really appreciate it!

vanillaslice said:
Hi there, I recently rooted my Google Pixel XL (8.1 Oreo) and have been working hard to optimise it much as possible. I noticed in my battery stats that "Mobile Network Standby" has taken about 60% of the usage since my last charge so I thought I'd make a nifty Tasker script to toggle it on and off when needed. I've done a little programming in the past and have tried to write the commands as simply as possible in a way I can comprehend...
Click to expand...
Click to collapse
I don't use Tasker but, the following area of the forum is specific to Tasker.
https://forum.xda-developers.com/u/tasker-tips-tricks
With that stated...
I believe that one or more of the following threads may be helpful for what you are looking to do and don't be afraid to ask for some member guidance within one of them too.
https://forum.xda-developers.com/showthread.php?t=3742629
https://forum.xda-developers.com/showthread.php?t=1110775
https://forum.xda-developers.com/showthread.php?t=890596
https://forum.xda-developers.com/showthread.php?t=3333728
Good Luck!
~~~~~~~~~~~~~~~
I DO NOT provide support via PM unless asked/requested by myself. PLEASE keep it in the threads where everyone can share.

Related

[Q] 4G auto-reconnect?

Anyone know if there is a way to have 4G auto-reconnect after it drops without having to click the scan button all the time? Script or setting? I know it will reconnect sometimes but I always have to scan again after it fails and I'm looking for a way to have it try to reconnect all the time until I turn it off.
4G does auto re-connect but not instantly. It's sort of on a timer and not a fast one to save battery. You can change it in ##DATA# I believe, but can't remember where. you need your msl. There's a post I think in the cdma dev section about improving your 4g if you search that can help better (at work or I'd spend the extra time for ya). Adjusting the time it rescans will be a huge drain to the battery though.

IMS_Data_Retry Keeps RAZR Awake

I've been using the app BetterBatteryStats as recommended by XDA to determine why my RAZR is awake much of the time, even when the screen is off and data is turned off. It turns out the problem is the internal process IMS_Data_Retry. This process apparently keeps attempting to establish a data connection over cellular data, at least 4G LTE. It aquires a wake lock while doing its work. This one process can keep the phone awake 95% of the time. The only way I have found to semi-stop it is to turn on 4G LTE. Even then, while it stops consuming CPU time (supposedly), the count of retry attempts keeps going up. (Putting the phone in Airplane mode also stops it, but then calls are stopped as well.)
There is a setting in /system/build.prop that I thought controlled this process:
ro.cdma.data_retry_config=default_randomization=2000,max_retries=infinite, 0, 0, 120000, 180000, 540000, 960000
I looked at some code references I found ( http://hi-android.info/src/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java.html ) and learned that the above values are in milliseconds. It seems that the default_randomization value is added to the other values in the list to create a schedule of retry attempts, but I wasn't able to figure out all the parameters to the method, if I even have the right one. I tried changing "infinite" to a small number under 10, but it had no effect - the process just keeps retrying forever.
Is there a dev out there who knows more about this? I want to limit this process because I seldom use cellular data right now and am usually on WiFi. It hinders any attempt to extend battery life. Is it a bug? Is it fixed in a later release (I'm on .748 stock) ? Do any of the custom ROMs have this problem? Can the build.prop setting I found be given values that limit the amount of time this process holds wake locks?
Thanks.
Did you ever get any resolution on this? For me, I think the problem started with the ICS update this summer. I constantly have gsm_data_tracker, RILJ, and IMS_Data_Retry using up the battery (in that order from highest to lowest). I tried wiping cache which helped the 1st time it cropped up and then it came back. I also tried a tip I saw somewhere for turning on airplane mode, rebooting, and turning off airplane mode (though mine as soon as it reboots, it already turns off airplane mode which it shouldn't). That worked for several weeks, but I had to do it EVERY DAY when I got to work. I think it's something with the 3g repeaters in the building. I did have it so it was wifi only (mobile radio off) on my work profile in profile scheduler, but then I needed cell for some mms stuff, so I ended up enabling it again. Basically when I come in the building and forget about my phone for an hour or 2, I go to get it out of my backpack and it will be hot from processing and 20% or more of the battery gone when I've done nothing in 2 hours of being at work. I saw somewhere that someone though either gsm_data_tracker or RILJ was related to something with the alarm, which I do use my phone as my alarm, but I use a 3rd party app. With the time change, there were a few days I woke up before it ever went off, so I turned it off before it did alarm. There were no differences with the partial wakelocks or battery drain in those cases. Unfortunately, I don't have another alarm readily available to get up for work right now and on the weekends when I don't need an alarm, I can't replicate the cell repeater at work issues, since I wouldn't be around the cell repeaters. As fart as in the building at work, until I reboot with airplane mode and all of that, the cell signal will bounce between like 0 bars/3g and lots of bars (no indication of network) and some bars with 1x network. It's all over the place. The airplane mode/reboot used to stabilize that, but it doesn't seem to be doing the trick anymore the last few days that I've tried that. I have to leave my phone on the charger as much as possible at work so that I don't leave for the day with a dead phone.

Figuring out the Lumia 920 + Heat + Battery Drain issue(s)...

I just wanted to post on the XDA forums that there is a thread to help determine what is causing the "heat + battery drain" issue(s) on the Lumia 920.
http://discussions.nokia.com/t5/Nok...n-ATT-Overheats-Battery-Draining/td-p/1606012
Specifically, we've seen fairly normal battery drain when using applications, but when LTE data is introduced the battery continues to drain at a rate of 7-8% per hour even after the applications are closed. For example, streaming something like Xbox Music or Netflix over the LTE connection (wifi OFF), the phone warms up considerably and the battery continues to drain at a high rate even after those applications are closed. The same applications behave normally over 3G or Wifi, and the battery drain is not present afterward.
The "fix" so far appears to be disabling LTE altogether.
• Open Dialer
• Punch in ##3282 and hit Call
• At the Field Test menu, choose more options via the three dots (lower right)
• Select Settings
• Under network type, select "3G only". UMTS should be set to "Automatic".
• Change the "Toggle ENS" setting to OFF
• Back out, power off the phone, and power on again
Definitely interested in hearing other's reports on this issue. Specifically, does this happen with ALL Lumia 920 phones? Is this specific to this particular model phone? Is this a Nokia issue, LTE chip issue, or WP8 issue? Was this introduced with the Portico update?
Thanks.
Upon further testing.........
Disabling LTE is *not* the ultimate fix. Yes, it does help keep the battery drain down to more reasonable levels, but it does not solve the problem. I've subsequently tested with the little brother phone -- the Lumia 820 -- to see if the issue is on all WP8 handsets, on all Lumia phones, or even limited to post-Portico update phones (in other words, did Portico make this issue).
After some thorough testing, I can say with confidence that this issue is specific to the Lumia 920 and not necessarily all WP8 handsets or Lumia phones.
Detailed thread here: http://discussions.nokia.com/t5/Nok...Overheats-Battery-Draining/m-p/1795212#M43837
I am currently working with Nokia to find a long-term resolution to this issue.
Please keep us updated, I'm very interested in knowing how to fix this problem! ??
I found that disabling bluetooth helps out.
Battery drain
To help reduce battery drain I do the following on my WP
I get a connectivity shortcut app. There are a few options available in the store. Anyway I pin airplane mode, Bluetooth, Wi-Fi, and Location on my home screen and turn them off when I'm not using them. Turning off location turns of GPS, so you must enable it before launching Drive/Here. A lot of battery issues I think have to do with the phone being to aggressive (power wise) trying to search for signal. Whether its Wi-Fi a Bluetooth device, etc. I also disable Tap+Send (NFC) because I never use it.
And I go into background tasks and I block every single app from running in the background except the ones I am sure I want to run. Remeber the list where you can block them is for apps that want to run on a timed schedule, they can still run in the BG if you home screen out of them. For me the only one I allow is MS Weather (for the live tile). Disabling Nokia Drive/Here seems to help battery life for some people.
The biggest battery saver I did was forwarding my other email accounts (Gmail & Yahoo!) to Outlook.com, and then set that to only look every 1 hour (instead of the stock 30 minutes). My phone went from lasting 1 - 1.5 days to over 2.5 - 3 days with my typical usage (light usage).
I try not to use Live Tiles, or lock screen pictures unless I really want them (like weather for instance), as they help drain the battery quicker.
Anyway Nokia is really on top of their game so I think they will help contribute to WP to eliminate these issues. The only non-software related issue with the 920 is the dust in the FFC, which personally does not bother me but I could see how it might bother others.
##3282 isn't working for me after yesterday's update. Lets see how I do with the battery today!!!
The earpiece on mine does not work I can't hear anyone and top of phone gets warm I have sent it to nokia repair.
yipcanjo said:
I just wanted to post on the XDA forums that there is a thread to help determine what is causing the "heat + battery drain" issue(s) on the Lumia 920.
http://discussions.nokia.com/t5/Nok...n-ATT-Overheats-Battery-Draining/td-p/1606012
Specifically, we've seen fairly normal battery drain when using applications, but when LTE data is introduced the battery continues to drain at a rate of 7-8% per hour even after the applications are closed. For example, streaming something like Xbox Music or Netflix over the LTE connection (wifi OFF), the phone warms up considerably and the battery continues to drain at a high rate even after those applications are closed. The same applications behave normally over 3G or Wifi, and the battery drain is not present afterward.
The "fix" so far appears to be disabling LTE altogether.
• Open Dialer
• Punch in ##3282 and hit Call
• At the Field Test menu, choose more options via the three dots (lower right)
• Select Settings
• Under network type, select "3G only". UMTS should be set to "Automatic".
• Change the "Toggle ENS" setting to OFF
• Back out, power off the phone, and power on again
Definitely interested in hearing other's reports on this issue. Specifically, does this happen with ALL Lumia 920 phones? Is this specific to this particular model phone? Is this a Nokia issue, LTE chip issue, or WP8 issue? Was this introduced with the Portico update?
Thanks.
Click to expand...
Click to collapse
Thanks for the tip!
I also have 5-8% per hour drain. (actual offi. release .1308...)
all off, sync, loaction, WLAN every thing, fresh reboot, phone on my desk, not working with it, about 2 lines H signal.
when i switch to airplane mode....1-2% battery drain over a complete night!
its also no problem to activate airplane mode ON and afterwards WLAN additionally ON, then about 1-4% over a night!
i tried everything i found on the inet.
and i have my white L920 since Dec.12! (i did a "hard" update over PC in Feb. and also the the last release over the air...nothing changed)
so now i'm checking if this works for me and post results
I'm located in AUT with an unlocked, unbranded GER L920.
and we dont have LTE til now...maybee thats the problem..?!
dj_memory said:
Thanks for the tip!
I also have 5-8% per hour drain. (actual offi. release .1308...)
all off, sync, loaction, WLAN every thing, fresh reboot, phone on my desk, not working with it, about 2 lines H signal.
when i switch to airplane mode....1-2% battery drain over a complete night!
its also no problem to activate airplane mode ON and afterwards WLAN additionally ON, then about 1-4% over a night!
i tried everything i found on the inet.
and i have my white L920 since Dec.12! (i did a "hard" update over PC in Feb. and also the the last release over the air...nothing changed)
so now i'm checking if this works for me and post results
I'm located in AUT with an unlocked, unbranded GER L920.
and we dont have LTE til now...maybee thats the problem..?!
Click to expand...
Click to collapse
UPDATE:
i solved my battery drain issue by setting my "max network speed" to 2G!
by that i now have a drain of 1-2% p.h.!
dj_memory said:
UPDATE:
i solved my battery drain issue by setting my "max network speed" to 2G!
by that i now have a drain of 1-2% p.h.!
Click to expand...
Click to collapse
That is great. To bad that we whom have received the latest OTA no longer have access to that menu.
really?
I'm on FW 1232.5957.1308.0001
and WPH 8.0.10211.204
I don't need to change the network type within ##3282 menu, also worked for me in normal network settings.
dj_memory said:
really?
I'm on FW 1232.5957.1308.0001
and WPH 8.0.10211.204
I don't need to change the network type within ##3282 menu, also worked for me in normal network settings.
Click to expand...
Click to collapse
So then how do you set your network speed?
u don't need access to ##3282...its also possible to "limit" within settings/network. (##3282 NOT working within f.e. Rapdialer!!)
I limit it to "2G" only when its more importand to have less battery consumption than inet speed
limited to "2G" in my region it shows me afterwards a "E" on top.
On this PIC i found in the inet is "roaming" deactivated.
I have to activate "roaming" also when I'm within my own network to have inet access (and the "E").
In my town, network operators share their mobile radio transmitters.
I limited direktly at my provider the access to a "real roaming network" for example a swiss network.
Because i'm most of the time near the border
maybee not possible in your version or provider?
I'm on a free GER version.
Definitely trying this tonight.
For the battery drain try light (white) theme. intresting but that help my battery drain problem
Same issue here...Any updates?
Battery drain and over heat
moshepupkin said:
Same issue here...Any updates?
Click to expand...
Click to collapse
My experience is that, I reset the cellphone and after doing this twice and connecting to the internet and waiting for one hour, Microsoft gave me an update for my battery saver and since that time everything is ok, including the battery. I always believed that the updates have problems to be installed completely most of the time, so it's better to reset or download it via the computer and instal it with a cable( using Nokia Software Update). But if it doesn't work, please don't panic. The updates are coming and just be sure that you have reset your device without choosing the setting backup, for you must start afresh. Good Luck.

Battery saving tips

Starting a thread to gather all the battery saving tip for the Gear S.
I don't have any yet, it is still 1 day old for me. I am looking at way to disable 3G. And rely on 2G. Anyone know of a way?
HappeningDude said:
Starting a thread to gather all the battery saving tip for the Gear S.
I don't have any yet, it is still 1 day old for me. I am looking at way to disable 3G. And rely on 2G. Anyone know of a way?
Click to expand...
Click to collapse
Settings > Connections > Mobile Networks > Network Mode > WCDMA/GSM or WCDMA only or GSM only.
GSM Only is 2G mode.
I don't have a Gear S yet Nov 7th can't come fast enough but I do have the Gear 2 for now and Wake-up Gesture was a huge battery hog I'd turn that off if it's in the Gear S
Thanks, friend. Manage to find it.
The gear last me from 630am to 830pm with around 16% battery left yesterday. I was using it as a standalone phone without pairing it to another phone. Made a call and received a few sms. 3G and Bluetooth was on all the time. I would said the battery is ok.
Gonna try it today on 2g network and Bluetooth off today.
Battery Life with GPS
If you, or anyone else who has the Gear S, is/are a runner, would you please check out the battery life with GPS on, Bluetooth on (and playing music), and 3G on?
Thanks,
Craig
craigkahn said:
If you, or anyone else who has the Gear S, is/are a runner, would you please check out the battery life with GPS on, Bluetooth on (and playing music), and 3G on?
Thanks,
Craig
Click to expand...
Click to collapse
Based on my last attempt at GPS, which I couldn't find a location without a paired phone, I think Samsung made some kind of screw up here.
Anyway, once it tries to use the GPS, battery drops very very quickly. My guess it that it will last 2 hours max.
Another day with Gear S. Pretty happy with it since it fills up my needs. Fantastic battery life based on my usage pattern.
Still using it as a standalone phone. With bluetooth and 3G turned off (stayed on 2G/EDGE), battery finished the day with 51% left. I unplug it at 630am and plug it back at 1030pm.
Usage pattern for the day are making a few phone call, and a couple of sms. Pedometer keeping track of my steps and warn me as necessary.
Where can I switch off the GPS and how can I switch from 3g to 2 g
peter7 said:
Where can I switch off the GPS and how can I switch from 3g to 2 g
Click to expand...
Click to collapse
Please specify instructions for this and what network you are on too. I'm on AT&T and would love to find this but I don't see where I have an option under connections for this.
So far, I've turned off GP (under connections - at bottom)
Turned off Gestures as I don't want it to light up unless I push the button
Set timeout to 10 seconds which is plenty for me
Since this uses an OLED screen, things that you might want to consider is using certain colors/themes.
1) Black is your best friend
2) If black is not an option, red > green > blue , yellow(red+green) > purple(red+blue) > cyan(green+blue) > white(red+green+blue)
3) use darker shades of colors when an option
Now not sure how much battery life this will add as it depends on how efficient is the screen. But in general, these are the OLED battery saving tips.
joytest said:
Settings > Connections > Mobile Networks > Network Mode > WCDMA/GSM or WCDMA only or GSM only.
GSM Only is 2G mode.
Click to expand...
Click to collapse
US carriers, especially AT&T, have a habit of remove such features in carrier variants. Sure enough, my AT&T Gear S doesn't have this option.
If you don't need full functionality all the time, try power saving mode.
You can tick a box to option mobile network on too - this then allows calls and text messages.
You only get a very basic screen, but the battery life dramatically improves. I am at 56% after 26hrs+ with a few quick calls and sending and receiving a few text messages.
going to try HappeningDude's idea and turn off 3g, not sure if power saving mode does this automatically or just enables mobile network with your already specified settings?
Having the option to change your watch face in power saving mode might be nice though? Although it is mostly black for obvious reasons.
foxbat121 said:
US carriers, especially AT&T, have a habit of remove such features in carrier variants. Sure enough, my AT&T Gear S doesn't have this option.
Click to expand...
Click to collapse
T-mobile does
while in T-mobile, i get connection error, and no Network mode appears.
Some of the options show however, like redirecting, etc, but no 2G/3G
raree said:
while in T-mobile, i get connection error, and no Network mode appears.
Some of the options show however, like redirecting, etc, but no 2G/3G
Click to expand...
Click to collapse
My Gear S gets 4G it maybe your coverage area
I use t mobile and do have only 3g
Sent from my SM-N910F using XDA Free mobile app
The optical sensor is quite accurate. I compared it with the Garmin Fenix 2 which uses a reliable traditional heart rate straps.
But it wouldn't last longer than ~2hrs of run with the heart rate monitor and GPS on.
I don't expect this watch to last a day of hike. Those kinds of activities are best saved for sport specific watches.
With heart rate sensor, gps and a run app going i lose 30% and hour. In theory, I should get about 3 hours of run time.
Has anyone quantified how much extra power the wake up gesture option uses? I have it off but would want to use it when I cannot touch the button.

Disable cellular when WiFi is present

O2 Germany offers this feature to route your calls/SMS/MMS through Wifi. Since I'm 9 hours a day working in a building where no cellular signal can reach me but wifi is present I might as well turn it off. (according to android battery management cellular network standby takes 11-15%) I know enabling airplane mode and then enabling wifi will do the job but is there no possibilty to simply switch it off?
My guess is that it consumes that much battery because it continuesly scans for a network. Is there at least a way to change the scan intervall?
btw my phone is OnePlus One running COS
Hello (liebe gruesse)
you can try llama (free) or Tasker (payed).
Llama is not more in development, but it is open source.
I think the last API level is 21 (Lollipop 5.0).
http://kebabapps.blogspot.de/?m=1
Tasker is still in development but closed source an cost around 3€,
but is made in Germany.
For Both Apps you need time to find out how it works.
The GUI are not the best, but hey you need it one time and let it run in the background.
I know with Llama can you select:
if WlanSSIDconnected = yourWlanName {tun off celluar}
else {turn celluar on}
Viel Glueck (have fun by try it out xD)

Categories

Resources