1. Download our Official Android App: Forums for Android!

Root Battery drain from using Tasker (I think)

Discussion in 'Android Devices' started by Roymus, Mar 8, 2011.

  1. Roymus

    Roymus Well-Known Member
    Thread Starter
    Rank:
    None
    Points:
    43
    Posts:
    203
    Joined:
    Jul 18, 2010

    Jul 18, 2010
    203
    26
    43
    I have a couple of profiles I've set up using Tasker to periodically look for WiFi and bluetooth connections and then set Bluetooth and WiFi on accordingly (there are many examples of these on forums, mine is pretty much the same except I don't use WiFi Near). Anyway, I've noticed some pretty significant battery drain lately so I checked Spare Parts partial wake usage and discovered that Tasker is now the biggest component (it used to be Android System). I think this means that Tasker is draining my battery, but I've been told that it shouldn't. Any advice? My apologies in advance if this is the wrong forum...moderator feel free to move if needed.
     

    Advertisement

  2. akazabam

    akazabam Android Expert
    Rank:
    None
    Points:
    313
    Posts:
    4,418
    Joined:
    Jun 7, 2010

    Jun 7, 2010
    4,418
    1,387
    313
    Near Los Angeles
    Tasker will certainly use wake locks if your profiles are set up to do so. Can you post all your current profiles?
     
  3. Roymus

    Roymus Well-Known Member
    Thread Starter
    Rank:
    None
    Points:
    43
    Posts:
    203
    Joined:
    Jul 18, 2010

    Jul 18, 2010
    203
    26
    43
    Not sure how to post profiles, but here are the wifi and bluetooth checker profiles:

    Context Time>Every 5 minutes
    // First check to see if wifi is already connected, if so quit
    If %WIFII = *CONNECTION*
    Stop
    Endif
    // Set WiFi on and wait 60 seconds to see if a remembered network is in range
    Set WIFI On
    Wait 60 Seconds
    // If WiFi is connected, quit
    If %WIFII = *CONNECTION*
    Stop
    Endif
    // Set WiFi off if not connected
    Set WiFi Off

    I also have a Bluetooth checker that is similar (except it uses variables because there is no way in Tasker to see if Bluetooth is connected)...it runs every 3 minutes and turns BT on for 30 seconds. Are the time intervals too frequent? Or perhaps the time I leave WiFi and BT on during the checks are too long?

    BTW, in case you suggest using WiFi Near...I've tried that and it's very unreliable (at least on my phone). I found using a set interval works better. In any case, I can't see it making any difference with battery life.
     
  4. akazabam

    akazabam Android Expert
    Rank:
    None
    Points:
    313
    Posts:
    4,418
    Joined:
    Jun 7, 2010

    Jun 7, 2010
    4,418
    1,387
    313
    Near Los Angeles
    Having tasker sleep, then do something, then sleep, then do somethings, etc. etc., will cause it to keep the phone awake. It's not meant to me used that way. Unfortunately, my recommendation is wifi near. The problem most people have with it is when you have a poor connection, you get disconnected, and it can go in start up/shutoff loops, etc. There are some tricks you can do with variables. Unfortunately, there is no good way of doing it with bluetooth yet. I recommend you think of a different solution for that. Remind me in the morning via PM or just bump this, and I'll give you some more detail.
     
  5. Roymus

    Roymus Well-Known Member
    Thread Starter
    Rank:
    None
    Points:
    43
    Posts:
    203
    Joined:
    Jul 18, 2010

    Jul 18, 2010
    203
    26
    43
    Doesn't WiFi Near essentially do the same thing: periodically turn WiFi on to see if there are known networks in the area? I was thinking there was no real difference in my setup, other than controlling the frequency of the checks (not sure how often WiFi Near runs, that was one of the several issues I had with it...my setup runs every 5 minutes guaranteed).

    My battery life is better today...Tasker's partial wake usage is now below Android System and Mail, where it should be. I made a couple of tweaks to the checker profiles that probably helped. I'm still open to trying WiFi Near out again if you can explain how it helps the wake usage...I think I can handle the variable checking.
     
  6. akazabam

    akazabam Android Expert
    Rank:
    None
    Points:
    313
    Posts:
    4,418
    Joined:
    Jun 7, 2010

    Jun 7, 2010
    4,418
    1,387
    313
    Near Los Angeles
    Wifi near is different in that it won't hold the phone awake between periods of turning on wifi to check for known/nearby wifi connections. When you have an action that just sleeps, it holds a wake lock. Wifi near won't do that.

    As far as the time between checks, you can configure that by going to menu->preferences, then select the monitor tab. You'll see a heading for "wifi scan seconds". That is the number of seconds the tasker will wait between polling wifi near while the screen is on. Below that, under "Display off timings", you see a box for all checks. Be careful what you set this to, as it will affect the timings for all the options you saw above (where wifi scan was). The number of seconds you put there will be how long it will wait between polling everything (including wifi near) while the screen is off.

    Another thing that kind of throws people off with wifi near is that it will wait two polling periods before turning off wifi. So, if you have the screen-off polling period set to 600 seconds (10 minutes), wifi near will check for nearby SSIDs every 10 minutes. If it doesn't find your connection, it keeps wifi on until it does another poll 10 minutes later. It does this just in case you have a bad connection. You don't want it accidentally turning off wifi. So, yes, it takes longer for wifi to turn off, but it holds a more reliable connection.

    Unfortunately, there is no current way of doing this with bluetooth. If I'm not mistaken, "bluetooth near" context functionality is in the works. But having the phone sleep, turn on bluetooth, sleep, repeat, is not a great idea in terms of battery life. A better idea is to define it based on conditions when you know you might need it, like when you plug in your phone (such as in the car) for example. There are many other ways to do it.
     
  7. Roymus

    Roymus Well-Known Member
    Thread Starter
    Rank:
    None
    Points:
    43
    Posts:
    203
    Joined:
    Jul 18, 2010

    Jul 18, 2010
    203
    26
    43
    So if I understand you correctly, using wifi near avoids the wake lock, but at the cost of it turning wifi on for polling purposes for substantially longer times (mine stays on for 60 seconds every five minutes). Not sure what that means in terms of battery life, but I'm guessing that having wifi on for less total time during the day saves more battery than avoiding the wake locks...of course, I could be wrong, I'll defer to you on that one. I also realize the benefits of more reliable wifi polling and avoiding random disconnects I experienced using wifi near. I'll experiment some anyway, as you make good points...appreciate the feedback!
     
  8. akazabam

    akazabam Android Expert
    Rank:
    None
    Points:
    313
    Posts:
    4,418
    Joined:
    Jun 7, 2010

    Jun 7, 2010
    4,418
    1,387
    313
    Near Los Angeles
    No, it doesn't stay on for long. I'd say it stays on for no more than 60 seconds at the most if it doesn't connect. The time between polls is configurable in settings, as I said. It just won't hold wake locks in between. You'll also be using a quite a bit of battery if this is the only context you use for that profile. What I mean is, if you're turning on wifi ever 5-10 minutes all day/night, it's going to use quite a bit of battery life. At the very least, have it turn off at night when you're not likely to go anywhere.
     
  9. stuarta

    stuarta Android Enthusiast
    Rank:
     #392
    Points:
    38
    Posts:
    350
    Joined:
    Feb 15, 2011

    Feb 15, 2011
    350
    22
    38
    Sorry just jumping on this. I have a wifi near context and wifi connected. How can I get the wifi near task to switch off when wifi connected is on?
     
  10. akazabam

    akazabam Android Expert
    Rank:
    None
    Points:
    313
    Posts:
    4,418
    Joined:
    Jun 7, 2010

    Jun 7, 2010
    4,418
    1,387
    313
    Near Los Angeles
    The whole point of wifi near is to connect to wifi when you're near, then turn off wifi when you aren't anymore. If you turn off wifi near when you're connected, it won't know to turn it back off when you leave. There are ways around this, but it's not really worth the effort. It won't use much battery to have tasker check wifi near when it's connected. Since wifi is already on, it takes very little time for it to figure out what it needs to do.
     
  11. Roymus

    Roymus Well-Known Member
    Thread Starter
    Rank:
    None
    Points:
    43
    Posts:
    203
    Joined:
    Jul 18, 2010

    Jul 18, 2010
    203
    26
    43
    Ok, I'm updating this post with my test results. I've been running with Wifi Near for about a week, and my findings are that it's not nearly as reliable as setting up a custom WiFi checker profile using a time context that runs every 5 minutes. The WiFi near will occasionally drop my connection and it will stay off for a while (hard to say, but I think 20-30 minutes at a time), plus the WiFi scan also appears to interrupt my Bluetooth connection in my car, not sure why. WiFi Near does not cause a wake lock and therefore uses less battery overall as pointed out earlier in this thread, but looking at the battery usage shows that the difference is less significant than I would've expected. Add to that the poor rellability of WiFi Near, and I'm going back to my manual WiFi Checker profile that runs every 5 minutes and behaves exactly the way I want it to! Thanks to all who provided input to this thread...any more tidbits are welcome of course, I absolutely don't consider myself an authority on this, and most of my data are empirical at best.
     
  12. noah way

    noah way Android Enthusiast
    Rank:
    None
    Points:
    68
    Posts:
    496
    Joined:
    Apr 20, 2010

    Apr 20, 2010
    496
    141
    68
    I'm having a power use issue. Spare Parts showed 25% use for Tasker. Uninstalled, rebooted, reinstalled. Seemed OK until I made some task widgets, then started getting erratic behavior and FC on some Tasker apps. Running SkyRaider 4.0.
     
  13. noah way

    noah way Android Enthusiast
    Rank:
    None
    Points:
    68
    Posts:
    496
    Joined:
    Apr 20, 2010

    Apr 20, 2010
    496
    141
    68
    Switched to Setting Profiles. Much easier to set up, will see what effect it has on the battery.
     
  14. akazabam

    akazabam Android Expert
    Rank:
    None
    Points:
    313
    Posts:
    4,418
    Joined:
    Jun 7, 2010

    Jun 7, 2010
    4,418
    1,387
    313
    Near Los Angeles
    Tasker does have a big learning curve, and is not the easiest to set up. That being said, it's definitely the most versatile. Also, you have to keep in mind that if you don't use it correctly, it can easily drain your battery. You should read through the online documentation for some best practices. There is nothing wrong with tasker if you use it correctly.
     
Tags:

Share This Page

Loading...