yashsingh1/xdaforums huggingface dataset:
[Android Software Development] pudman:
Thanks for this. Tried writing something similar when I first got my DesireHD but it didn't seem to save much battery. I then moved to Juice Defender but some parts of that stopped working so I then tried super power which seemed to work as expected but I didn't get huge battery savings.

I'm losing about 1% battery per hour with my phone in standby & using your profiles which is pretty amazing. I did remove the 2G/3G switching though as that didn't seem to be supported on my phone - not sure why. Also, I wasn't sure what I was meant to do with locale or its execution plugin. Perhaps I needed this for the switching? Will re-read the thread and try and figure it out. Thanks again.
[Android Software Development] brandall:
Glad they are working for you :)

The locale execute plugin was only needed in initial releases so you could see from the logcat what your device was up to when it was syncing - were there applications and widgets you didn't need any more trying to pull background data etc. This proved to be a counter productive resource in the end, so I removed them. Locale is good for many other things though.

There is a HUGE tasker update coming soon - for details see here . I hope that solves the 2g/3g issue which many users have. The beta is hidden here should you wish to try it out before official release.

If your device has good reception on 2g only and the call quality is acceptable, then it's another great way of saving some battery power. It's fine for me and I never switch to 3g unless I'm using the mobile data connection or on the road in an unknown reception area.

Any questions, happy to help.
[Android Software Development] sabret00the:
Just a quick huge expression of thanks to brandall. He helped me out with a modified version of this of which I'm really grateful for.
[Android Software Development] brandall:
Thanks for your thanks :)
[Android Software Development] y3mita:
Question? How can I make Tasker handle GPS in gingerbread roms?
[Android Software Development] brandall:
Read my usual reply here :)

Applications shouldn't use GPS unless they are active...
[Android Software Development] y3mita:
Great it used to be on all the time I remember. Im glad I can leave it ticked on. I was trying to use the find phone GPS thing until I got that message gingerbread does not let you have other apps handle GPS
[Android Software Development] brandall:
I'm sure you'll see it uses no extra battery power. You may need to tweak a few settings in your browser to disable location search (if you want to) etc but if the GPS symbol does pop up in the notification bar, it should be pretty easy to tell which app/circumstance has triggered it and untick a setting somewhere....
[Android Software Development] y3mita:
Thanks so much for the input brother
[Android Software Development] strictlyrude27:
brandall -

I don't run this profile scheme myself, and the reason for that is as follows:

I used to have a generic profile that turned on Auto-sync every half hour if I was on *any* wifi. For kicks, I used SystemPanel to look at the battery life to compare this to just leaving push sync on. I charged my battery to full, then unplugged and let sit for 8 hours.

I found that turning on/off autosync (i.e., scheduling sync) dropped me from 100% to 88% battery over 8 hours, while leaving autosync dropped from 100% to 94%. Furthermore, looking at the plots of CPU usage showed a spike every half hour from 3% to 10+%, while no spike occurred with just leaving auto-sync on.

I would show pictures but I forgot to take them. I can redo the experiment if you want.

So I guess what I'm getting at is, I don't think turning on/off autosync is as much a battery saver as just leaving push syncing on in the first place. Right now I only activate autosync when I'm on a preferred wifi connection, but I don't toggle it on/off.

I think I want to rerun this experiment. There could be other factors in play here..

Thoughts?
[Android Software Development] brandall:
Hi strictly, they are certainly interesting findings! My immediate reaction is to say something is seriously a miss...!

The idea to have everything off is to prevent the constant connection and use of background data whenever notifications/applications desire. My results went from 20-30% at the end of the day to 70-80% (with casual usage).

Having 'nothing' connected/happening in between sync times, should mean your device is deep-sleeping. It is then given 1-2 minutes to do whatever it wants. In this 1-2 minutes, even if it is maxing out the CPU, it can't drain the battery substantially...

Had you left wifi scanning on or something?? You might want to check in my signature for the deep-sleep-detective profiles I'm working on. They might point out an issue!

Please do run the experiment again!
[Android Software Development] strictlyrude27:
This makes total sense. I was astonished with my findings. I got rid of every unnecessary program that used data and tried the experiment multiple times - every time, when sync kicks in there was a spike in CPU usage and gapps (gmail, calendar, etc) usage corresponded to those spikes.

I think push sync was designed intelligently enough to not kill battery. Certainly when my Facebook app went from scheduled sync to push sync, its usage went down significantly. Anyhow, this definitely merits further investigation. Certainly there is some issue with my phone..?

I'm using SystemPanel to do that work. Graphical, with plots, etc, and a breakdown of which apps run when.

I will post results in the next few days..
[Android Software Development] brandall:
The CPU spikes are of course understandable as it's all of the processes that have been sat waiting, all trying to do what they need to as a connection is established. But that spike is limited to 1-2 minutes as a direct result - if you view the data afterwards a spike will continue of course...

Just to make sure we are not at crossed purposes here - Are you saying that you are leaving the data connection on all of the time?? With push settings on too?

If this is the case then assuming no emails/facebook/twitter updates at all (all things being equal), it would be data connection on for 24 minutes (1 minute per hour) v's data connection on for 24 hours!?

Or are you saying that you have your data off until a scheduled sync slot but all of your applications are set to 'push' or sync constantly, rather than just 30 minutes or 1 hour apart?

So that would be 'push' v's 'fetch' - is that what you mean? I can't see that being possible either as 'push' does not fetch the actual data in a different way (as far as I know?)

I guess I'll wait for your results! I really hope they don't show the same or it will baffle me into having to find out!!
[Android Software Development] strictlyrude27:
Yeah, data is left on all the time. I've been doing my tests with a wifi connection only, however, so I shouldn't be turn on/off mobile data.

I use data for more than just getting emails/etc., for instance using the web or finding bus routes. I'm not yet sure if the time delay in turning data on for those apps and turning it off afterward is worth it since I consider myself to be a power user.

What I did is turn off auto-sync, then toggle it on every 30 minutes; leave it running on to fetch new data; then turn it back off.

I think that's the issue. A push is akin to the phone being "interrupted" with new data, whereas a "fetch" is the phone actively seeking it. I think that when autosync is initially off then turned on, it tries to sync all the data it didn't get while being off first, i.e., fetch; after being left on a while it'll revert to push.

It'll take two days to test, since I leave the phone on overnight and let SystemPanel run. I will leave Tasker active but deactivate all profiles for the first run, then keep it on push sync; and then I'll only activate the profile that toggles autosync on/off every half hour.
[Android Software Development] brandall:
I have my fingers crossed your first results were wrong!! This would cost me too many hours of research on Google...! :eek:

What is your wifi policy set to under advanced wifi options? Not that that could really make any difference...

Anyway, I'll await the good news!
[Android Software Development] strictlyrude27:
"Never" right now. Wifi sleep policy is to flip between wifi and 3G when wifi isn't being used, isn't it?
[Android Software Development] brandall:
I thought it was the screen-off policy..? I may be wrong though...
[Android Software Development] hyuuu:
you just reminded me to redownload tasker for my phone, how much ACTUAL savings can we get really?
[Android Software Development] brandall:
I best let someone else answer that....

800+ downloads and I don't see any complaints.... :cool:
[Android Software Development] strictlyrude27:
brandall -

all the pictures i took came out poorly (stupid root toast notifications); only two was actually useful.

Both images examine Tasker's CPU usage; total battery charge; and total CPU usage. The first image is with autosync left on overnight, the second is with push notifications. It's somewhat hard to see the delta-battery (I didn't start at 100% battery unfortunately), but it looks like the rate of discharge is lower with leaving autosync on.

Of course, correlation does not imply causation and if you would shell out for SystemManager Pro I would like to see your own results. I'm messing with a different kernel now (smartass governor) and maybe that'll completely mitigate battery issues entirely (got less than 1% CPU usage all night last night running smartass).
[Android Software Development] brandall:
I am totally baffled... Before I even start to run this test myself (I have process monitor widget pro and system panel and a few others!) I know that if I left my wifi on overnight, the battery on my desire would be down to less than 80% in the morning, that's without having 'push' on! Running an hourly sync with wifi on only for that time (so 8 minutes of use assuming 8 hours) I'm at above 95% with my device in deep sleep in between times... So running this is a bit of a no-brainer for me! :confused: Do you see what I mean??

Maybe there are big differences between our devices/roms that means yours doesn't drain the battery and can therefore consider what causes drain when it is on - but for me, having wifi or mobile data on at all is a battery killer for me... regardless of anything else!

Let me know I've understood what you've done correctly and you can get through a night with wifi and push on and it hardly touches your battery?!

My upgrade is due in a couple of weeks, I really hope my new device performs like that!
[Android Software Development] strictlyrude27:
What version of Android are you running? I'm now on 2.3.4 but was on 2.2 at the time of these tests.

It could very well be a hardware thing - if I leave wifi on all night and don't sync, my battery barely budges. This past test wasn't the greatest (about 10% battery loss through the night) but I'm searching for other causes on that one. I know for a fact that I've done this before and had ~2% battery loss.

So I guess the takehome message is, "try before you buy". That goes for a lot of things - anecdotes make for good testimony but typically I require hard evidence before I believe anything about anything - not that I don't believe you and the others who have downloaded your profiles when they say they saved lots of battery with this!
[Android Software Development] brandall:
You gotta love a good anecdote! You're very lucky that you can consider whether the act of pushing or 'pulling' will make a difference to you - for me it's the connection being on at all :( that was my motivation for creating these. Perhaps I should have considered what was constantly active to be causing the data to be used, but I have a lot of apps and just settled that the background permissions and misaligned syncs were the culprit... This solving the issue for me made me look no further....

I'm on 2.3.4, but can't blame the ROM, it's amazing - far superior to anything else for the Desire - maybe my device/battery is screwed, but hey, a Sensation will be mine in a few weeks (I think that's what I've decided on - depends on unlocked bootloaders..)!

Gunna PM you shortly about an application.... Keep um peeled :eek:
[Android Software Development] raiderkilo:
Hi

I use Your profiles for more as one month and all work perfect.

THX
[Android Software Development] brandall:
Thanks for the feedback :) Glad they are working out for you
[Android Software Development] tleish:
Failed to import profile

When I try to "Open" the WIFIPREFCON.tsk.xml with Tasker in android, I get the error "File Import: Failed to move import to my SD directory".

All the other xml files imported just fine, but this one will not. When I browser to a different directory in Tasker to import the file, this profile will not display. I just installed Tasker 1.0.21u2m
[Android Software Development] brandall:
I can't think what the problem would be...? There are no actions within that task that would cause an issue on an updated version... Can you try unzipping the folder on your pc and dragging the task into sdcard/tasker/tasks when you are connected via USB. See if that works and if not let me know...
[Android Software Development] tleish:
Thanks for the tip. 'sdcard/tasker/tasks' folder didn't exists, only 'sdcard/tasker/profiles'. I created the 'tasks' folder and it fixed the error. I was able to import the task into tasker.

Unfortunately I've run into another error. I can't import AutoSync.prf.xml. I've been able to import the other 3 profiles using 'Import One Profile', but when I try to import AutoSync I get the error "Error: Import of AutoSync.prf.xml failed: failed to import profile data."

Do I need to pre-define a variable or something in order to be able to import this profile?
[Android Software Development] brandall:
It's strange that the folder was not created... Are you running the latest version? Have you tried unzipping them first and placing them individually in the task or profile folders? If that fails, I would suggest you backup your data and uninstall and reinstall Tasker. There's no obvious reason why they shouldn't import I'm afraid... Make sure you're not forcing Tasker to install on the SD in anyway too...

If that doesn't work, let me know and we'll investigate further...
[Android Software Development] juan3211:
I had the same import error.

You have to update your app to the last version.

Bye,

NOTE: My next post will be a question/bug. Please answer me !!!
[Android Software Development] juan3211:
Question about sync email client

First of all, Brandall thanks for this great script.

I was working with and no problem with gmail or google contacts.

But I can't get managed with Email Client or K-9 Mail (I try K-9 also).

As you say here:

"7)

"Don't forget to set all of your applications and widgets etc that will be syncing to just below the AutoSync repeat time!"

So if the AutoSync repeat time is set to 30 min, the AppSync time should be <29 min...?

/Peter

"

In order to test it I put my email client and sync time or 1 hour, and your state repeat time in 2 hour.

Let's go: 1 hour < 2 hour, but still doesn't work.

I also try by making longer the sync time, from 1 minute to 5 minutes, but nothing happens.

Email and K-9 work perfectly, but doesn't autosync.

Have I to put 59 minutes and 1 hour, or 1:59 and 2 hour ? Is it correct 1 hour and 2 hour or your time event profile ?

Thanks a lot.
[Android Software Development] speedyv79:
Wifii.txt not created

It seems that my wifii.txt isn't created. I added the "File" option in the Wifiprefcon task at the end and that seems to work but I don't know what the correct location for this option in this task is.

After the "import" of the task there are 7 steps defined. It feels like something is missing.

Hope you can help :)

Vern
[Android Software Development] brandall:
Hi speedyv79, the wifii.txt will be on the root of the storage card, not hidden in any folder. It may not appear until the task has run for the first time. Let me know if you can't locate it.

Hi juan3211, are you syncing with an exchange server? When the email fails to sync, can you go to the email application and press 'refresh' manually and see if it works please. Is the account you are hoping will sync detailed correctly under Accounts and Sync in Android settings? Let me know and we'll go from there.
[Android Software Development] speedyv79:
Hello Brandall,

I meant that the file won't get created. It seems that something is missing form the Wifiprefcon task. As a test I added a "file" step at the end of the Wifiprefcon task and did another test. The file got created after adding that step in the root of the SD card. I don't know if that's the right location or step to put the file option in though.

After import the task consisted of 7 step. After my modification it consists of 8 step.
[Android Software Development] brandall:
I'm with you now speedy - I've just looked at the first post and seen that I still reference the %WIFII details being read from a file - this happened in an older version and was dropped to just splitting %WIFII in the end. I need to update that information - thank you.

You've done exactly the right thing of adding a write file action with the content of %WIFII and that would indeed make the task consist of 8 actions.

Does that put your pondering to rest?
[Android Software Development] strictlyrude27:
brandall -

I'm going to give your profiles another try and modify them to deal with the fact that my phone is AWESOME with battery when wifi is connected :)

I did modify your profile scheme though - and I think you'd want to include my modifications to make working with your profiles easier. I use the concept of pseudoarrays and build a list of preferred wifi connections, %WIFILIST. This way I don't have to add a bunch of new Variable Set If statements to 3 or 4 profiles. I index into the array using %WIFILOC. Not only does this index into my wifi list, but upon successful completion %WIFILOC now gives an index into that array that gives my current location. If I walk %WIFILIST and I'm not on a preferred wifi connection, I clear %WIFILOC - I'm at an unknown location.

So say my home SSID is "Wifi1" and my work SSID is "Wifi2". If %WIFILOC=1, then I'm at home, and %WIFILOC=2 corresponds to work. Now I can have location-based profiles, AND keep the profiles relatively tidy.

It does take some setting up, but with beta-Tasker's new Variable Editor it shouldn't be hard. People using current stable Tasker could write their array to a file, then use Read Line to slurp the array into Tasker.

The array would be as follows: %WIFILIST = x(1)Wifi1(1)(2)Wifi2(2)(3)Wifi3(3)x - as we've seen before in pseudoarray work.

Here is the new task WIFIOnConVar (you'll need to make corresponding changes in the other profiles, but those are just clearing %WIFILOC and removing the old %WIFIHOME, %WIFIWORK, etc):

Perform task WIFIPREFCON

Wait 4 seconds

Variable Set %WIFIOC to 2

Variable Set %WIFILOC to 1

Variable Split %WIFILIST, splitter (%WIFILOC)

Variable Clear %WIFILIST1

Variable Clear %WIFILIST3

----------------------------------

If %WIFILIST2 ~ %WIFIPREF // found a match in our array! cleanup and quit

Variable Clear %WIFILIST2

Stop

End If

----------------------------------

If %WIFILIST2 is set // we're still walking the array, haven't matched the current SSID yet

Variable Clear %WIFILIST2

Variable Add %WIFILOC, 1

Goto Action 5

Stop // likely not necessary, but here for user readability

End If

----------------------------------

If %WIFILIST2 ! Set // hit end of array, no matches were found

Variable Clear %WIFILOC

Variable Clear %WIFILIST2

End If
[Android Software Development] brandall:
Fantastic work Strictly... loving the concept and the variable editor will make light work of inserting into the array...

I must admit, I'm knackered (see your email)! So, I may need to digest this after a few more hours sleep, but would %WIFIPREF ~ *%WIFILIST* save the need for some loops (assuming that is available in pattern matching)?

I'll look over properly tomorrow, but think this is the way forward.... :)
[Android Software Development] strictlyrude27:
I don't think it would - we know that %WIFILIST2 contains the SSID that we want to compare to - we need this to survive to check it against the IF statements. I can't just clean up after all the IF checks are done, because one of them has a GOTO in it - if %WIFILIST2 survives but we're at the end of the array, it won't get cleared. So I kill %WIFILIST1 and %WIFILIST3 outside all that immediately since they're not used.

Get some sleep. You've been going to bed at like 4am every day for the past couple weeks. You're not in college anymore.. ;)
[Android Software Development] brandall:
HA! I really probably should... but currently resolving binary injection issues... I'll re-visit these tomorrow...

I've used all my thanks meter thanks in the DSD thread, but will return and +1 tomorrow!
[Android Software Development] juan3211:
Hi brandall, thanks a lot for your fast response.

I'll try to answer you (sorry about my english)

I use CyanogenMod 7.0.3 rom on my Wildfire, and it cames with android simple email cliente.

I also try K-9 mail client.

My accounts are HOTMAIL and another one trough POP3

I can go to email or K-9 clients and preshing "refresh" manually they work perfect.

These two apps have a autosync configuration time, but they DON'T appear under Settings\Account and Sync.

May be is it necessary to have them here ? I suposse that with the autosync configuration time of email and K-9 client it'd have to work, wouldn't it ?

Thanks a lot
[Android Software Development] brandall:
Your English is fine :)

Ok, I don't think you can enter a POP3 account in auto-sync, so let's forget that as the issue.

Does your device usually remain with the screen off between syncs?

It looks like the email client isn't registering that it wants to sync when there is a data connection active. This wouldn't happen if your device was 'sleeping', which is great for your battery, but not so great to get your emails straight away!

Can you increase the wait time to 15 minutes and see if that gives the email app a chance to register it can sync. Send yourself an email from your pc, so you know there is one waiting to come through.

Let me know and we'll go from there.
[Android Software Development] speedyv79:
Yes thanks! :D I'm testing the setup at the moment. I'll let you know If it works as expected!

Greetz, Vern
[Android Software Development] brandall:
Please do :) I welcome any feedback!
[Android Software Development] speedyv79:
Hello Brandall,

Well it works like a charm! I'm testing battery life at the moment but thats looking great now.

One thing that doesn't work is switching of the 2g data after the sync is done. I start the cycle with all data connections off. When not at home it eventually connects to 2g but after the sync the connections isn't dropped.

Thanks!
[Android Software Development] brandall:
Glad to hear it's nearly fully working! There are a few issues kicking around with device/ROM/Android version and the data connection controls. I haven't used it personally, but I know these issues can be solved by APNDroid from the market which has a Tasker plugin. If that doesn't work, let me know and I'll investigate further for you.
[Android Software Development] Earon:
Trying to customize your profiles, i'm going mad because can't get it to work.

What i try is this:

-Turn on manually wifi when arrive at home.

-While wifi keeps connected to a known network, keep it up with data sync, and turn off mobile data and bluetooth

-When wifi loses connection with a known network (i go out of home, i.e.), turn off wifi and data sync, else turn on mobile data and bluetooth

-If bluetooth connects to my hands-free, turn volume up to max (and more things, but enough for now :D)

Well, how could i do this? Nothing i try works :confused:

Thank you!! Your threads about tasker are awesome :eek: