Recently I decided to start using Juice Defender, but after two days of use, I figured I could do the same thing or better with Tasker. Personally, I was annoyed with the lack of a delay between turning my screen off and JD turning off my data. Sometimes I would turn off my screen for 10 seconds and see that the data was off (and my phone had yet to even lock). I had to reinstall Pandora after this because it would give me an error every time it loaded. The purpose of this post is to give other people ideas about how to replace Juice Defender, and to perhaps get ideas from others about how to improve upon this. These profiles will do two things:
1) Wait 4 minutes after my screen is turned off (I have it set to lock after 2 minutes of screen off) to turn off mobile data and auto-sync.
2) Wait 12 minutes after data/auto-sync are turned off to turn them back on for 1 minute and repeat this process every 12 minutes until phone is unlocked.
There are 3 profiles and each is linked to one task.
Profile: Screen Off (24)
Event: Display Off
Enter: Net Off (25)
A1: Wait [ MS:0 Seconds:0 Minutes:4 Hours:0 Days:0 ]
A2: Mobile Data [ Set: Off ] If [ %SCREEN ~ off ]
A3: Auto-Sync [ Set: Off ] If [ %SCREEN ~ off ]
A4: Variable Set [ Name:%DATA To: off Do Maths: Off Append: Off ] If [ %SCREEN ~ off ]
Profile: Screen On (26)
Event: Display Unlocked
Enter: Net On (29)
A1: Mobile Data [ Set: On ]
A2: Auto-Sync [ Set: On ]
A3: Variable Set [ Name:%DATA To: on Do Maths: Off Append: Off ]
A4: Stop [ With Error: Off Tasking ]
Profile: Ping (34)
Event: Variable Set [ Variable:%DATA Value: off ]
Enter: Ping (32)
A1: Wait [ MS:0 Seconds:0 Minutes:12 Hours:0 Days:0 ]
A2: Mobile Data [ Set: On ] If [ %DATA ~ off ]
A3: Auto-Sync [ Set: On ] If [ %DATA ~ off ]
A4: Wait [ MS:0 Seconds:0 Minutes:1 Hours:0 Days:0 ] If [ %DATA ~ off ]
A5: Mobile Data [ Set: Off ] If [ %DATA ~ off ]
A6: Auto-Sync [ Set: Off ] If [ %DATA ~ off ]
A7: Perform Task [ Nameing Stop: Off Priority:1 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: ] If [ %DATA ~ off ]
I struggled with the "Ping" task for a while before coming to do it this way. The Ping profile will wait until the data is turned off, wait 12 minutes, then do a 1 minute ping, turning data and sync back on. This process will be repeated every 13 minutes and will be stopped only when I unlock my phone. However, I'm worried that it will keep my phone awake or end up taking more battery than necessary.
P.S. Obviously this doesn't take current network activity into consideration, but I figure that most things that I do in the background, I do on a charger. When running Pandora in my car, I keep my screen stay on and plug it in. When updating apps, I do so on Wifi. I may encounter apps that require me to change this profile, but until then, this is all I need.
EDIT: This latter context (Ping 2) does not appear to work now that I've tested it for weeks and looked at the logs. This could explain why the "Ping" context wakes your phone more often than "Ping 2". I'm leaving this so that maybe someone that is more informed can help me make it work.
I also thought of one other way to do this. I could use a Time-based profile as follows:
Profile: Ping 2 (36)
Event: Variable Set [ Variable:%DATA Value: off ]
Time: Every 10m
Enter: Ping 2 (32)
A1: Wait [ MS:0 Seconds:0 Minutes:5 Hours:0 Days:0 ]
A2: Mobile Data [ Set: On ] If [ %DATA ~ off ]
A3: Auto-Sync [ Set: On ] If [ %DATA ~ off ]
A4: Wait [ MS:0 Seconds:0 Minutes:1 Hours:0 Days:0 ] If [ %DATA ~ off ]
A5: Mobile Data [ Set: Off ] If [ %DATA ~ off ]
A6: Auto-Sync [ Set: Off ] If [ %DATA ~ off ]
Using this profile instead, the 1 minute "pings" would repeat every 10 minute starting 5 minutes after the data is first turned off. I will be testing this over the next couple of days, but unfortunately I lack experience using any battery-logging apps and will just be doing it by eye. Would anyone recommend one way over the other, or perhaps any other changes that I can make?
Click to expand...
Click to collapse
Thanks for sharing it, I have set the profile in tasker with ping time based, will share update by tomorrow
hoping for the best.
Thanks
Jitu
S3- Lord of the Phones.
What is the purpose of pinging periodically... just to check for new emails?
electricpete1 said:
What is the purpose of pinging periodically... just to check for new emails?
Click to expand...
Click to collapse
Yes, and any other things requiring an internet connection. Google Talk, Facebook, etc. Juice Defender has this very same functionality. That's where I got the idea.
So, I should mention that after a couple of days I've had a lot of success with the timer-based Ping task (Ping 2 listed above). The other (Ping 1) does seem to keep my phone awake more, but also works decently.
i have set for sync, every 5 hours, sync and data turns on and off to sync with google, and thats mostly it
Sent from my Desire HD using Tapatalk 2
XML file
TherynK said:
So, I should mention that after a couple of days I've had a lot of success with the timer-based Ping task (Ping 2 listed above). The other (Ping 1) does seem to keep my phone awake more, but also works decently.
Click to expand...
Click to collapse
Hi I tried to create profiles and task,,, but seems like it not running at all. Can u please share its XML file.
Thanks
Jitu
Thanks for this, I've just installed Tasker and this is the first thing I've tried. So far it looks to be working well - I have BetterBatteryStats installed and for the previous two days it was showing my battery consumption as being around 5-6% per hour. So far with this profile running in Tasker its down at 3% per hour so I'm happy
I've not got JuiceDefender installed so can't compare it with that just now but if I get a chance to I'll put it on (and then maybe GO Power Master) and see how they stack up. I prefer the idea of tasker though as it seems to be able to replace several apps in one.
Thanks
Thanks for sharing!! I'm trying out tasker and your profiles are my first... looking good!!
Nice trick, im going to try it!
I've noticed that my Ping 2 context does not trigger. Going back to trying the original Ping context.
im going to try it, sure it works great, thanks
I also recommend Llama
It can do almost everything that tasker (and obviously more things than JD) does and for free
Search it on Play store
I tested Tasker, JD, and Llama and i also find the last one more stable, so im using it actually
Enlight me...
Could you explain A7 from your Ping profile??
I'm new to Tasker, and I'm also trying to implement this save battery function.
TherynK said:
I've noticed that my Ping 2 context does not trigger. Going back to trying the original Ping context.
Click to expand...
Click to collapse
Is the original Ping context working for you?
Sent from my DROID RAZR HD using xda app-developers app
Thanks for sharing it
i am trying to do the ping 2 profile but i dont get how i do to insert the 10 mins in the profile,i can only add the variable event
any help?
Thanks!
Hi,
i've created tasker profile with this.
but i want to limit the profile to run only from certain time of the day (7:00 - 23:00), 23:00 - 7:00 no sync, no internet connection.
how do i set this up ?
I have a profile set up already to turn off all connection from 23:00 - 7:00, will my profile override the sync?
Thank you
TherynK said:
Recently I decided to start using Juice Defender, but after two days of use, I figured I could do the same thing or better with Tasker. Personally, I was annoyed with the lack of a delay between turning my screen off and JD turning off my data. Sometimes I would turn off my screen for 10 seconds and see that the data was off (and my phone had yet to even lock). I had to reinstall Pandora after this because it would give me an error every time it loaded. The purpose of this post is to give other people ideas about how to replace Juice Defender, and to perhaps get ideas from others about how to improve upon this. These profiles will do two things:
1) Wait 4 minutes after my screen is turned off (I have it set to lock after 2 minutes of screen off) to turn off mobile data and auto-sync.
2) Wait 12 minutes after data/auto-sync are turned off to turn them back on for 1 minute and repeat this process every 12 minutes until phone is unlocked.
There are 3 profiles and each is linked to one task.
Profile: Screen Off (24)
Event: Display Off
Enter: Net Off (25)
A1: Wait [ MS:0 Seconds:0 Minutes:4 Hours:0 Days:0 ]
A2: Mobile Data [ Set: Off ] If [ %SCREEN ~ off ]
A3: Auto-Sync [ Set: Off ] If [ %SCREEN ~ off ]
A4: Variable Set [ Name:%DATA To: off Do Maths: Off Append: Off ] If [ %SCREEN ~ off ]
Profile: Screen On (26)
Event: Display Unlocked
Enter: Net On (29)
A1: Mobile Data [ Set: On ]
A2: Auto-Sync [ Set: On ]
A3: Variable Set [ Name:%DATA To: on Do Maths: Off Append: Off ]
A4: Stop [ With Error: Off Tasking ]
Profile: Ping (34)
Event: Variable Set [ Variable:%DATA Value: off ]
Enter: Ping (32)
A1: Wait [ MS:0 Seconds:0 Minutes:12 Hours:0 Days:0 ]
A2: Mobile Data [ Set: On ] If [ %DATA ~ off ]
A3: Auto-Sync [ Set: On ] If [ %DATA ~ off ]
A4: Wait [ MS:0 Seconds:0 Minutes:1 Hours:0 Days:0 ] If [ %DATA ~ off ]
A5: Mobile Data [ Set: Off ] If [ %DATA ~ off ]
A6: Auto-Sync [ Set: Off ] If [ %DATA ~ off ]
A7: Perform Task [ Nameing Stop: Off Priority:1 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: ] If [ %DATA ~ off ]
I struggled with the "Ping" task for a while before coming to do it this way. The Ping profile will wait until the data is turned off, wait 12 minutes, then do a 1 minute ping, turning data and sync back on. This process will be repeated every 13 minutes and will be stopped only when I unlock my phone. However, I'm worried that it will keep my phone awake or end up taking more battery than necessary.
P.S. Obviously this doesn't take current network activity into consideration, but I figure that most things that I do in the background, I do on a charger. When running Pandora in my car, I keep my screen stay on and plug it in. When updating apps, I do so on Wifi. I may encounter apps that require me to change this profile, but until then, this is all I need.
EDIT: This latter context (Ping 2) does not appear to work now that I've tested it for weeks and looked at the logs. This could explain why the "Ping" context wakes your phone more often than "Ping 2". I'm leaving this so that maybe someone that is more informed can help me make it work.
Click to expand...
Click to collapse
Is there any plugin or event to monitor the downloading speed of mobile data. The idea is to set a event trigger which triggers the "Net Off"-task if the download goes under certain threshold. For example if I set threshold as [50 KB/10 seconds] then the event is triggered soon the download speed goes under 50KB and for stays below continuously for more than 10 seconds.
I saw the above feature in Juice Defender Plus/Ultimate version. This cuts the data after all downloads is finished. In the profiles you shared it cuts the data after 4 mins even some download is going on. The another issue is data stays on for 4 mins even after it is not needed or all downloads are finished.
Hello TherynK,
This post really looks promising .. I have tried to build this profile but getting a little confused at the last step of the PING part. Is there a was to simplify that and would it be possible if you can post the profile download linke...
Thanks
Related
I have a few questions.
I tried to make my own Juice Defender replacement:
Data Check -
Contexts:
Time
From 6:30
every 15 min
To 01:00
Power
Any
Inverted
Tasks:
Stop
if %SCREEN ~ ON
Stop
if %CELLSIG < 1
Mobile Data
On
Auto-Sync
On
Wait
2 min
Auto-Sync
Off
Mobile Data
Off
For some reason I can't set an end task, but I think I got around it. What this should do is when my screen is off and I have service it should check for any sort of notifications (facebook, mail), correct? Also, will I still get texts and calls instantly or does Mobile Data include these?
you shouldn't use the wait there as while tasker is waiting those 2 min nothing else can run.
I posted my tasks for this in another thread recently: http://forum.xda-developers.com/showpost.php?p=11097712&postcount=14
Is there anything else I can use instead of wait? I don't really want to make 4 profiles. Also I tried doing something else and it's not working. I attempted to make a Night Mode, however it doesn't turn on:
Nightenable:
Contexts:
From 1:00 Till 6:29
Tasks:
Variable Set %NIGHT, 1
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Night Mode:
Contexts:
Variable Set %NIGHT, 1
Tasks:
Lower Volume, etc.
why don't you want to use 4 tasks? That's the most ellegant way to do it
for the night mode don't set the variable but set the stuff you want straight away
I would do it in one task except I also have this:
Power Mode:
Contexts:
Power On
Tasks: (Menu)
(Night Mode) Variable Set %NIGHT, 1
(Normal Mode) Variable Set %NIGHT, 0
Vulf said:
I have a few questions.
I tried to make my own Juice Defender replacement:
Data Check -
Contexts:
Time
From 6:30
every 15 min
To 01:00
...
...
For some reason I can't set an end task, but I think I got around it. What this should do is when my screen is off and I have service it should check for any sort of notifications (facebook, mail), correct? Also, will I still get texts and calls instantly or does Mobile Data include these?
Click to expand...
Click to collapse
How I do this:
Profile: Sleep
Time
From 23:00
un-checked
To 05:59
---------------------------------------
Tasks: Sleep
Notification Pulse
OffRinger Volume
5Mobile data
OffWiFi
OffBluetooth
OffAuto-Sync
OffDisplay Brightness
15---------------------------------------
Exit Tasks: Awake
Notification Pulse
OnRinger Volume
15Auto Brightness
On
I utilize a whole other Project with several Profiles to control the Wifi & Mobile Data usage. now working on a BT radio policy
I noticed some time ago that every few days or few weeks the Android 2.2 restarts on Optimus T. I searched and found lots of complaints (seems like a problem with Android in general?) but no solution. I wrote a Python script to try to track down this problem, and kept it running in SL4A:
Code:
import android
droid = android.Android()
import os, time
while (1):
print os.system("ps >/sdcard/ps.log; date > /sdcard/date.log; dmesg > /sdcard/dmesg.log")
time.sleep(1)
I ran it and after it restarted, I checked the files to see what it was doing right before crashing and rebooting. Among the dmesg I found a lot of repeating messages, one section looked a bit suspicious, where freezing tasks failed:
Code:
<4>[318167.964203] [Accelerometer] accel_power_on() : Power On
<4>[318167.972857] Restarting tasks ... done.
<6>[318167.999805] suspend: exit suspend, ret = -16 (2012-05-19 00:57:54.801113344 UTC)
<6>[318169.465067] PM: Syncing filesystems ... done.
<4>[318169.659290] Freezing user space processes ...
<3>[318169.670165] Freezing of tasks aborted after 0.01 seconds (699 tasks refusing to freeze):
<4>[318169.670712]
<4>[318169.670723] Restarting tasks ... done.
<6>[318169.691207] suspend: exit suspend, ret = -16 (2012-05-19 00:57:56.492516690 UTC)
<6>[318169.909787] PM: Syncing filesystems ... done.
<4>[318170.179340] Freezing user space processes ... (elapsed 0.01 seconds) done.
<4>[318170.190343] Freezing remaining freezable tasks ... (elapsed 0.00 seconds) done.
<4>[318170.190720] Suspending console(s) (use no_console_suspend to debug)
<4>[318170.191713] [Accelerometer] accel_power_off() : Power Off
<4>[318170.191745] [Ecompass] ecom_power_set() : Power Off
<7>[318170.192597] msmrtc_tod_proc_result: 05/19/2012 00:57:56 (05)
<7>[318170.193368] msmrtc_tod_proc_result: 05/19/2012 00:57:56 (05)
<7>[318170.193928] msmrtc_tod_proc_result: 05/19/2012 00:57:56 (05)
<7>[318170.194657] msmrtc_tod_proc_result: 05/19/2012 00:57:56 (05)
<6>[318170.195345] LGE: Android Vibrator Driver Suspend
<7>[318170.195373] <6>[msm_battery] msm_batt_suspend()...
<6>[318170.209093] thunderg_pwrsink_suspend_noirq: configure gpio for suspend
<6>[318170.209093] wakeup wake lock: rpcrotuer_smd_xprt
<6>[318170.209387] thunderg_pwrsink_resume_noirq: configure gpio for resume
<7>[318170.217893] <6>[msm_battery] msm_batt_resume()...
<6>[318170.219265] LGE: Android Vibrator Driver Resume
<7>[318170.220772] msmrtc_tod_proc_result: 05/19/2012 00:57:56 (05)
<7>[318170.222005] msmrtc_tod_proc_result: 05/19/2012 00:57:56 (05)
<4>[318170.222082] [Ecompass] ecom_power_set() : Power On
<4>[318170.224318] [Accelerometer] accel_power_on() : Power On
<4>[318170.230735] Restarting tasks ... done.
<6>[318170.252233] suspend: exit suspend, ret = 0 (2012-05-19 00:57:57.053883355 UTC)
<6>[318170.324958] PM: Syncing filesystems ... done.
<4>[318170.405000] Freezing user space processes ... (elapsed 0.03 seconds) done.
<4>[318170.442000] Freezing remaining freezable tasks ... (elapsed 0.00 seconds) done.
<4>[318170.443337] Suspending console(s) (use no_console_suspend to debug)
<4>[318170.446660] [Accelerometer] accel_power_off() : Power Off
<4>[318170.446785] [Ecompass] ecom_power_set() : Power Off
Are these anything related to random reboots, or is there a better way to diagnose what's wrong here?
Bump - any ideas? I have read that other phones have similar restart problems.
Well, I think this is a quite old post but recently I got same problem and I need log for debug too...
zhangxiao83 said:
Well, I think this is a quite old post but recently I got same problem and I need log for debug too...
Click to expand...
Click to collapse
Then provide a log.
Hi, I have been looking for a solution for this problem for quite a while myself, and today I found a way to collect the current value of data transferred and sent on all interfaces. Altho, I will not take credit for this part, nor will I bother to find the original poster, I will however share with you a more detailed explanation on how to set it up, and some ways to make use of it.
First off, this is what will happen
Situation 1. Headphones, Streaming with Spotify - When screen goes off, a variable with the current value of data transferred will be set, after 7 minutes an updated value will be set, we will get the difference between these two and thus get the amount of data transferred, if this is higher than a certain level, nothing will happen! (I.e spotify will continue to stream even tho screen is off)
The reason why I have used 7 minutes is this:Say you put on a song, it is 3 minutes long, after 30 seconds your screen goes off, the song is already downloaded when the traffic calculations will take place, using 7 minutes(or more), will in most cases lead to more than one song being played during the calculation, "ensuring" the capture of traffic data.
Situation 2. Headphones, No stream - Data will turn off after 7 minutes
Situation 3. No headphones, No Stream - Data will turn off after 2 minutes
Situation 4. No headphones, Stream - In my case, data will also turn off after 2 minutes(since this is not an issue for me) if you do however have issues with this, change the point A8 in section 2.2 below
In all cases: If the screen is turned On within the 7 or 2 minutes(depending on situation) the calculation will cancel! (i.e if you are surfing the web and screen goes black during a read)
1. Add some variables (I do not know if this is actually necessary!)
Open tasker, go to the variables tab on the top right corner and press the "+" button in order to add a variable, add these:
%CHEA 0
%CHEAB 0
%DIFF 0
%HEAD Off
2. Add some tasks (In the tasks tab)
-Make a new task called Checknet, press the options button(the screwdrivers) and set Collision handling to: Run both together, and keep device awake: on
Next is the list of what to do, this is not a script, add them one by one manually!
A1: Read Paragraph [ File: /proc/self/net/dev Para:1 To Var:%tet ]
A2: Variable Set [ Name:%newline To:
Do Mathsff Append: Off ]
A3: Variable Split [ Name:%tet Splitter:%newline Delete Base: Off ]
A4: For [ Variable:%line Items:%tet(3 ]
A5: Variable Split [ Name:%line Splitter: Delete Base: Off ]
A6: Variable Add [ Name:%rxb Value:%line2 Wrap Around:0 ]
A7: Variable Add [ Name:%txb Value:%line10 Wrap Around:0 ]
A8: End For
A9: Variable Set [ Name:%totalb To:%rxb+%txb Do Maths: On Append: Off ]
A10: Return [ Value:%totalb Stop: On ]
2.1 Add another task and call it Chediff
A1: Add a Perform Task (Found under the Task section) and choose Checknet, make sure to set the "Return Value Variable" value to %CHEA
A2: Add a Wait and set it to 7 minutes (This can be tuned, however you will have issues if you set this too low, I will explain later)
A3: Add another Perform Task, choose Checknet again, and set the "Return Value Variable" to %CHEAB
A4: Add another Wait, I use 2 seconds (For some reason it calculates wrong without this)
A5:Add a Variable set - Set %DIFF to: (%CHEAB-%CHEA)/1000 (Select "Do Maths")
2.2 Add one last task, and call it Dispoff
A1: If %HEAD ~ On
A2: Perform task Chediff
A3: If %DIFF < 1000
A4: Mobile data off
A5: WiFi off
A6: End if
A7: Else
A8: Wait 2 minutes (You could use another "Chediff" (perhaps with a lower waiting walue? Would need to duplicate it tho), but personally I have no reason for it)
A9: Mobile data off
A10: WiFi off
A11: End if
3. Add some profiles
1. On state, hardware, Headset plugged (any) - Variable set %HEAD On
2. On state, hardware, Headset plugged (any) check the invert box - Variable set %HEAD Off
3. On event, Display On - Use 3x stop tasks to stop, Chediff, Dispoff and Chenet
4. On event, Display Off - Perform task "Dispoff"
Hmmm
Interesting...I have been trying to figure out a solution similar to this. In my case, I listen to a lot things not only via headphones but also through the speakers. I would like my wifi or 3g (depending on which one is connected) to stay on even if the app is in the background and or the screen is off. I think I may be able to tweak this to my needs...thank you....
EDIT: task A2 of Task 2, this doenst seem clear. What are we supposed to enter for in the Variable Set box?
Also A4, what is %tet set to? In the post it says %tet(3 but I dont think this is right
edit
I got the task to read the data values from the dev file. The original post was a bit confusing so here it is again with some notes that may help:
A1: Read Paragraph [ File: /proc/self/net/dev Para:1 To Var:%tet ]
A2: Variable Set [ Name:%newline To: Do Maths: Off Append: Off ] >> in order to have the Variable Set to blank you need to press Enter two times in the To box
A3: Variable Split [ Name:%tet Splitter:%newline Delete Base: Off ]
A4: For [ Variable:%line Items:%tet(3 ]
A5: Variable Split [ Name:%line Splitter: Delete Base: Off ] >> enter a [space] in the Splitter box
A6: Variable Add [ Name:%rxb Value:%line2 Wrap Around:0 ]
A7: Variable Add [ Name:%txb Value:%line10 Wrap Around:0 ]
A8: End For
A9: Variable Set [ Name:%totalb To:%rxb+%txb Do Maths: On Append: Off ]
A10: Return [ Value:%totalb Stop: On ]
So I got this and the %DIFF task working. Now I am trying to write a profile to turn off wifi and 3g is the streaming data amount is low (i.e I am no longer streaming music or media).
A little help would be appreciated
I've been trying to make this work for a while, but my CHDIFF just doesnt seem to be doing its maths right,
For instance, onf the latest run i got CHEA 282554 and CHEB 289286, so (%CHEB-%CHEA)1000 should be like 6700/1000 = 6.7, right??
However the result shown on %DIFF is -221.962 for these numbers.... W-T-F??
EDIT: Okay, I think I got this to work (Thanks!), but the odd thing is that the CHECKNET is coming up with values (around 140,000) even when there is nothing downloading or when both WiFi and Data are turned off.... hmmm=?
Amazing!!
Thanks for this small "Tutorial". Everything works really fine!!
parthipanramesh said:
Thanks for this small "Tutorial". Everything works really fine!!
Click to expand...
Click to collapse
Yup, been using this for a while now. I love it!
Can you make a profile for wifi to switch off when the screen is off please? Dont need wifi to switch on when screen is on
ermacwins said:
Can you make a profile for wifi to switch off when the screen is off please? Dont need wifi to switch on when screen is on
Click to expand...
Click to collapse
oh thats easy..what I have is a delay of 30 secs after the screen turns off to see if the phone is turned back and an app that i designate as using Wifi is opened, if not then I turn off the wifi, otherwise I leave it on. I also have another profile checking to see if I have a streaming app running is, if so I will leave the wifi on. %streamapp is used in conjunction with the profile above to see if data is still being streamed.
Profile - wifi off
Context:
Event - display off
Variable - %streamapp ~ false
Tasks:
Wait 30 secs
If %display ~ on (I have another profile that checks the status of the display, on or off)
If %wifiapp ~ true (I have another profile that checks if an app I designate as needing wifi is running in the foreground)
Stop
End if
Else
Wifi off
End if
Screen off=wifi/data off if no stream or download active
Hey Guys,
I created a new thread: http://forum.xda-developers.com/showthread.php?t=2127481 to make it a little bit clear. Cz this is not my thread and I don't want to upset the thread owner.
I'd like to welcome you in my thread.
parthipanramesh said:
Context:
State - Display off
State - Wifi connected
Tasks:
Run task → Checkdiff (Create all the tasks from the first post!!)
If: %DIFF<1000
Wifi → off
End if
Stop → if %wifi~off
Goto Action 1
This profile will check if your streaming or downloading something and will only switch off wifi if you don't have traffic. If you have traffic it will run this task every 2 min until you don't have traffic. (Download/Streaming completed)
Click to expand...
Click to collapse
Hi
Can you please share your xml files?
I've tried to perform step by step but with no sucess....
Many thanks
toyjeep said:
Hi
Can you please share your xml files?
I've tried to perform step by step but with no sucess....
Many thanks
Click to expand...
Click to collapse
Hi toyjeep,
yes of course. I updated my post above yours and tweaked the tasks.
Have a look! Ask me if you have problems
Hope I helped you
parthipanramesh said:
Hi toyjeep,
yes of course. I updated my post above yours and tweaked the tasks.
Have a look! Ask me if you have problems
Hope I helped you
Click to expand...
Click to collapse
Thanks work almost perfect...
when task Screen off (wifi) runs it gives this error:
Variable convert: %CHECKA_WIFI: no value
Whats wrong??
BR
toyjeep said:
Thanks work almost perfect...
when task Screen off (wifi) runs it gives this error:
Variable convert: %CHECKA_WIFI: no value
Whats wrong??
BR
Click to expand...
Click to collapse
Click on the Screen off (wifi) task and press on Variable Convert: %CHECKA_WIFI. Look if it looks like this "Variable Convert: Name: %CHECKA_WIFI ;Function: Bytes to Kilobytes ;Store Result In: %CHECKA_WIFI".
Did you use my xml file?
parthipanramesh said:
Click on the Screen off (wifi) task and press on Variable Convert: %CHECKA_WIFI. Look if it looks like this "Variable Convert: Name: %CHECKA_WIFI ;Function: Bytes to Kilobytes ;Store Result In: %CHECKA_WIFI".
Did you use my xml file?
Click to expand...
Click to collapse
I had just imported your file
No messing around.....
---- edit -----
After anwser went to tab variable and it have a value now.
I think i'm understanding...
With WIFI off - If I go to task and "play", the value in variable goes to (none, empty)
With WIFI ON - It works well.
---------- Post added at 10:01 PM ---------- Previous post was at 09:52 PM ----------
Ok its working!
Testing with wifi off was the cause to the error.
Now I've tweaked a little the task SCREEN OFF
Screen off (4)
A1: Wait [ MS:0 Seconds:10 Minutes:0 Hours:0 Days:0 ]
A2: If [ %SCREEN ~ on ]
A3: Goto [ Type:Action Number Number:1 Label: ]
A4: Else If [ %SCREEN ~ off ]
A5: Perform Task [ Name:Screen off (Data) Stopff Priority:5 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: ]
A6: Perform Task [ Name:Screen off (Wifi) Stopff Priority:5 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: ]
A7: Vibrate [ Time:200 ]
A8: End If
Now I have 10 seconds to turn on again the phone and dont lose the connection.
If the screen is on it goes in loop!
What do you think?
toyjeep said:
I had just imported your file
No messing around.....
---- edit -----
After anwser went to tab variable and it have a value now.
I think i'm understanding...
With WIFI off - If I go to task and "play", the value in variable goes to (none, empty)
With WIFI ON - It works well.
---------- Post added at 10:01 PM ---------- Previous post was at 09:52 PM ----------
Ok its working!
Testing with wifi off was the cause to the error.
Now I've tweaked a little the task SCREEN OFF
Screen off (4)
A1: Wait [ MS:0 Seconds:10 Minutes:0 Hours:0 Days:0 ]
A2: If [ %SCREEN ~ on ]
A3: Goto [ Type:Action Number Number:1 Label: ]
A4: Else If [ %SCREEN ~ off ]
A5: Perform Task [ Name:Screen off (Data) Stopff Priority:5 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: ]
A6: Perform Task [ Name:Screen off (Wifi) Stopff Priority:5 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: ]
A7: Vibrate [ Time:200 ]
A8: End If
Now I have 10 seconds to turn on again the phone and dont lose the connection.
If the screen is on it goes in loop!
What do you think?
Click to expand...
Click to collapse
It's a good idea but this profile only runs if the screen is on You can set up an exit task which stops the Screen off task or which turns wifi on.
toyjeep said:
Thanks work almost perfect...
when task Screen off (wifi) runs it gives this error:
Variable convert: %CHECKA_WIFI: no value
Whats wrong??
BR
Click to expand...
Click to collapse
I have modified the script to get away that error
1.Name: Screen off (Wifi)
2.Run Shell: Command: cat sys/class/net/wlan0/statistics/rx_bytes ;Store Result In: %CHECKA_WIFI ;Continue Task After Error: yes
3.Variable Convert: Name: %CHECKA_WIFI ;Function: Bytes to Kilobytes ;Store Result In: %CHECKA_WIFI
Add in 1: Variable Set: Name: %CHECKA_WIFI; To:0; If %CHECKA_WIFI !set
4.Wait: 30 seconds
5.Run Shell: Command: cat sys/class/net/wlan0/statistics/rx_bytes ;Store Result In: %CHECKB_WIFI ;Continue Task After Error: yes
6.Variable Convert: Name: %CHECKB_WIFI ;Function: Bytes to Kilobytes ;Store Result In: %CHECKB_WIFI
Add in 2: Variable Set: Name: %CHECKB_WIFI; To:0; If %CHECKB_WIFI !set
7.Wait: 2 seconds (need to wait or it won't do the maths correctly)
8.Variable Set: Name: %DIFF_WIFI ;To: %CHECKB_WIFI-%CHECKA_WIFI ;Do Maths: yes
9.If: %DIFF_WIFI < 15
10.Mobile Data: off
11.Stop: Task: Screen off (Wifi)
12.Else:
13.Wait: 2 Minutes
14.Goto: Type Action Number ;Number: 1
15.End if
Basically if the CHECKA_WIFI and CHECKB_WIFI no value, it will set the value to 0
Any chance you could post the fixed/updated xml files? It would be ever so gracious.
wl3gan said:
I have modified the script to get away that error
1.Name: Screen off (Wifi)
2.Run Shell: Command: cat sys/class/net/wlan0/statistics/rx_bytes ;Store Result In: %CHECKA_WIFI ;Continue Task After Error: yes
3.Variable Convert: Name: %CHECKA_WIFI ;Function: Bytes to Kilobytes ;Store Result In: %CHECKA_WIFI
Add in 1: Variable Set: Name: %CHECKA_WIFI; To:0; If %CHECKA_WIFI !set
4.Wait: 30 seconds
5.Run Shell: Command: cat sys/class/net/wlan0/statistics/rx_bytes ;Store Result In: %CHECKB_WIFI ;Continue Task After Error: yes
6.Variable Convert: Name: %CHECKB_WIFI ;Function: Bytes to Kilobytes ;Store Result In: %CHECKB_WIFI
Add in 2: Variable Set: Name: %CHECKB_WIFI; To:0; If %CHECKB_WIFI !set
7.Wait: 2 seconds (need to wait or it won't do the maths correctly)
8.Variable Set: Name: %DIFF_WIFI ;To: %CHECKB_WIFI-%CHECKA_WIFI ;Do Maths: yes
9.If: %DIFF_WIFI < 15
10.Mobile Data: off
11.Stop: Task: Screen off (Wifi)
12.Else:
13.Wait: 2 Minutes
14.Goto: Type Action Number ;Number: 1
15.End if
Basically if the CHECKA_WIFI and CHECKB_WIFI no value, it will set the value to 0
Click to expand...
Click to collapse
Hi,
The error persists
Screen off (Wifi) (12)
A1: Run Shell [ Command:cat sys/class/net/wlan0/statistics/rx_bytes Timeout (Seconds):0 Use Rootff Store Result In:%CHECKA_WIFI Continue Task After Errorn ]
A2: Variable Convert [ Name:%CHECKA_WIFI Function:Bytes to Kilobytes Store Result In:%CHECKA_WIFI ]
A3: Variable Set [ Name:%CHECKA_WIFI To:0 Do Mathsff Appendff ] If [ %CHECKA_WIFI ! Set ]
A4: Wait [ MS:0 Seconds:30 Minutes:0 Hours:0 Days:0 ]
A5: Run Shell [ Command:cat sys/class/net/wlan0/statistics/rx_bytes Timeout (Seconds):0 Use Rootff Store Result In:%CHECKB_WIFI Continue Task After Errorn ]
A6: Variable Convert [ Name:%CHECKB_WIFI Function:Bytes to Kilobytes Store Result In:%CHECKB_WIFI ]
A7: Variable Set [ Name:%CHECKB_WIFI To:0 Do Mathsff Appendff ] If [ %CHECKB_WIFI ! Set ]
A8: Wait [ MS:0 Seconds:2 Minutes:0 Hours:0 Days:0 ]
A9: Variable Set [ Name:%DIFF_WIFI To:%CHECKB_WIFI-%CHECKA_WIFI Do Mathsn Appendff ]
A10: If [ %DIFF_WIFI < 15 ]
A11: WiFi [ Setff ] If [ %SCREEN ~ off ]
A12: Silent Mode [ Modeff ]
A13: Auto-Sync [ Setff ]
A14: Stop [ With Errorff Task:Screen off (Wifi) ] If [ %SCREEN ~ off ]
A15: Else
A16: Wait [ MS:0 Seconds:0 Minutes:2 Hours:0 Days:0 ]
A17: Goto [ Type:Action Number Number:1 Label: ]
A18: End If
A19: Vibrate Pattern X [ Pattern:100,100,100,100,100,100 ]
A20: Auto-Sync [ Setff ]
A21: Silent Mode [ Modeff ]
Is this ok??
I'm looking for an app that will alert me when it's getting late.
Scenario: I'm using my phone, and it's "suddenly" 2am. The app (ideally) pops up to tell me to go to sleep.
I would like to be able to set a range: alerts every 30 minutes from 11pm until my screen is off.
Anyone have any app suggestions?
Tasker to the rescue! Here is a profile that I created that does exactly what I want!
Profile: It's Late (4)
Time: From 23:00 every 30m Till 06:00
Enter: Go To Sleep Alert (7)
A1: Popup [ Title:Go To Sleep Text:It's %TIME Background Image: Layoutopup Timeout (Seconds):10 Show Over Keyguardn ] If [ %SCREEN eq on ]
Hope it's helpful to someone!
I am trying to keep my new Galaxy S7 unrooted for a variety of reasons.
I have searched high and low for some clever way to turn on/off the cell radio under automated control such as with Tasker, without root. Is it really not possible?
My need for this is threefold. I use voip when I am on WiFi and have no need for any cellular access during those times.
1) My home is in a cell dead zone and turning off the cell radio saves battery
2) I get "double" incoming calls - once over voip and again over the cell network
3) I am more exposed to spam calls when I am on the cellular network. This is because all legitimate calls come in via google voice, which has good spam control, but when I'm on the cell network spammers also reach me by dialing my cell phone's native number, which is unprotected from spam.
Needless to say, I know how to turn off the cell network manually (indirectly by going into airplane mode, then re-enabling wifi). I want to automate this switching.
Ideas appreciated!
Unfortunately nothing to do about that without root since Jellybean 4.2...
Somebody has created complicated ways to turn airplane mode on/off using macro recording for simulating the required physical screen touches.
johnpane said:
I am trying to keep my new Galaxy S7 unrooted for a variety of reasons.
I have searched high and low for some clever way to turn on/off the cell radio under automated control such as with Tasker, without root. Is it really not possible?
My need for this is threefold. I use voip when I am on WiFi and have no need for any cellular access during those times.
1) My home is in a cell dead zone and turning off the cell radio saves battery
2) I get "double" incoming calls - once over voip and again over the cell network
3) I am more exposed to spam calls when I am on the cellular network. This is because all legitimate calls come in via google voice, which has good spam control, but when I'm on the cell network spammers also reach me by dialing my cell phone's native number, which is unprotected from spam.
Needless to say, I know how to turn off the cell network manually (indirectly by going into airplane mode, then re-enabling wifi). I want to automate this switching.
Ideas appreciated!
Click to expand...
Click to collapse
This really isn't that complicated. Like the previous poster suggested, this can be accomplished/automated by simulating input. I use Tasker + AutoInput to enter flight mode every night and exit it every morning. Oh, and to click away that horrid volume warning pop-up too.
Google around and search XDA, there are multiple threads on the subject.
Fruktsallad said:
This really isn't that complicated. Like the previous poster suggested, this can be accomplished/automated by simulating input. I use Tasker + AutoInput to enter flight mode every night and exit it every morning. Oh, and to click away that horrid volume warning pop-up too.
Click to expand...
Click to collapse
Thank you for the suggestion to use AutoInput. AutoInput is a very nice tool, but not a very good solution for the need I described. AutoInput cannot work if the screen is locked. It will also be very disruptive if I am doing an interactive task on the phone at the time the action is triggered, which is likely to occur because the automation would be triggered any time I enter or leave a WiFi network. On my previous (rooted) device, I had this set up to all occur in the background, whether the phone was locked or I was using it - fast and transparent.
I am surprised that the system has become so locked down that manipulating airplane mode and related features cannot be automated any other way than the through simulating user input. If the user is allowed to do it, why have the developers decided not to let the user grant permission to an app to do it?
johnpane said:
Thank you for the suggestion to use AutoInput. AutoInput is a very nice tool, but not a very good solution for the need I described. AutoInput cannot work if the screen is locked. It will also be very disruptive if I am doing an interactive task on the phone at the time the action is triggered, which is likely to occur because the automation would be triggered any time I enter or leave a WiFi network. On my previous (rooted) device, I had this set up to all occur in the background, whether the phone was locked or I was using it - fast and transparent.
I am surprised that the system has become so locked down that manipulating airplane mode and related features cannot be automated any other way than the through simulating user input. If the user is allowed to do it, why have the developers decided not to let the user grant permission to an app to do it?
Click to expand...
Click to collapse
Why they chose to restrict airplane mode permissions is beyond me. A really stupid move imho.
However, I see no problem providing conditions in Tasker so that it the task only triggers when you're not actively using the phone for instance. It can then turn on the screen for the second or two that's needed for pressing the buttons.
Fruktsallad said:
However, I see no problem providing conditions in Tasker so that it the task only triggers when you're not actively using the phone
Click to expand...
Click to collapse
I repeat, "AutoInput cannot work if the screen is locked."
An automatic task is useless if it only works when I have the screen unlocked but am not using the device. That is practically never.
johnpane said:
I repeat, "AutoInput cannot work if the screen is locked."
Click to expand...
Click to collapse
Repeating it doesn't make it any less incorrect.
I'm using AutoInput just fine with the screen locked. Fingerprint security always active. I lock my phone and put it on the charger each night. The task is triggered, secure settings wakes the screen for a few seconds while AutoInput does it magic.
It just works.
Hmm, I have tested exactly what you describe, including waking the screen with Secure Settings. On my Galaxy S7 running Android 6.0.1., AutoInput is not able to change Airplane Mode when the screen is locked with fingerprint security.
EDIT: Yes, I see that it can work. I had to change from using the Airplane Mode Settings to using the Quick Settings. Thank you for your help!
johnpane said:
Hmm, I have tested exactly what you describe, including waking the screen with Secure Settings. On my Galaxy S7 running Android 6.0.1., AutoInput is not able to change Airplane Mode when the screen is locked with fingerprint security.
EDIT: Yes, I see that it can work. I had to change from using the Airplane Mode Settings to using the Quick Settings. Thank you for your help!
Click to expand...
Click to collapse
Hi John, its been some time from this post but, would you mind sharing how you manage to get Autoinput work while the phone is locked? I have been trying with no success, the task I have performs just fine by hitting play in tasker
It worked on Marshmallow, but since the upgrade to Nougat it no longer works. I have it set up to wait for the screen to be unlocked before trying to run the rest of the script.
johnpane said:
It worked on Marshmallow, but since the upgrade to Nougat it no longer works. I have it set up to wait for the screen to be unlocked before trying to run the rest of the script.
Click to expand...
Click to collapse
Thanks for your quick reply
I still have marshmallow, how can I do it to make it work
cheers
Here are the relevant excerpts from my (marshmallow) scripts. %JPDISP is a variable I maintained whether the screen is on (unlocked or not).
Turn cell off v6 (6)
A7: Secure Settings [ Configuration:CPU Awake Only 3 Seconds Timeout (Seconds):0 Continue Task After Errorn ] If [ %JPDISP ~ 0 ]
A8: AutoInput Global Action [ Configuration:Action: Quick Settings Timeout (Seconds):3 Continue Task After Errorn ] If [ %JPDISP ~ 1 ]
A9: Wait [ MS:50 Seconds:0 Minutes:0 Hours:0 Days:0 ]
A10: AutoInput Action [ Configuration:Type: Text
Value: Airplane mode
Action : Click
Is Tasker Action: true
Check Screen State: false Timeout (Seconds):3 Continue Task After Errorn ] If [ %AIR ~ off ]
A11: Wait [ MS:50 Seconds:0 Minutes:0 Hours:0 Days:0 ]
A12: AutoInput Action [ Configuration:Type: Text
Value: TURN ON
Nearby Text: CANCEL
Action : Click
Is Tasker Action: true
Check Screen State: false Timeout (Seconds):3 Continue Task After Errorn ] If [ %AIR ~ off ]
A13: Close System Dialogs
A14: Variable Set [ Name:%JPTIMEOUT To:%qtime+15 Recurse Variablesff Do Mathsn Appendff ]
A15: Wait Until [ MS:200 Seconds:0 Minutes:0 Hours:0 Days:0 ] If [ %AIR ~ on | %qtime > %JPTIMEOUT ]
A16: Goto [ Type:Action Number Number:7 Label: ] If [ %AIR ~ off ]
A17: Bluetooth [ Setn ] If [ %BLUE ~ off ]
A18: Secure Settings [ Configuration:Wifi Enabled Timeout (Seconds):0 Continue Task After Errorn ] If [ %WIFI ~ off ]
A19: Variable Set [ Name:%JPTIMEOUT To:%qtime+15 Recurse Variablesff Do Mathsn Appendff ]
A20: Wait Until [ MS:200 Seconds:0 Minutes:0 Hours:0 Days:0 ] If [ %WIFI ~ on | %qtime > %JPTIMEOUT ]
A21: Goto [ Type:Action Number Number:18 Label: ] If [ %WIFI ~ off ]
A22: Variable Set [ Name:%JPTIMEOUT To:%qtime+15 Recurse Variablesff Do Mathsn Appendff ]
Turn cell on v5 (22)
A4: Secure Settings [ Configuration:CPU Awake Only 3 Seconds Timeout (Seconds):0 ]
A5: AutoInput Global Action [ Configuration:Action: Quick Settings Timeout (Seconds):3 Continue Task After Errorn ]
A6: Wait [ MS:50 Seconds:0 Minutes:0 Hours:0 Days:0 ]
A7: AutoInput Action [ Configuration:Type: Text
Value: Airplane Mode
Nearby Text: NFC
Action : Click
Is Tasker Action: true
Check Screen State: false Timeout (Seconds):3 Continue Task After Errorn ] If [ %AIR ~ on ]
A8: Close System Dialogs
OMG why do they make it so hard to do this? Is it so these companies can continue to track everything we do? That is the only reason I can see them making it hard to accomplish this without a root or 2-3 apps with optimal settings (it's hard enough to get my LED indicator to work properly without a 3rd party app).