[Q] Help with Tasker

Search This thread

PsychDrummer

Senior Member
Nov 29, 2012
732
110
Hey everyone, first I'm not really sure if this belongs in a Tasker forums. Seeing as I use a N5, I figured it could also go here. Anyway, I've been having some problems with Npl wakelocks. I downloaded wakelock terminator with xposed and it seemed to have helped, however something didn't seem right as my battery was draining the same amount as when the wakelocks were happening. The only time I wasn't having the drain was when location was set to device only, which makes sense.

I'm completely new to tasker. I've watched a few tutorials and I've messed around with it a bit but with not much luck. I wanted to do one of two things. Either have location set to battery saver/high accuracy when the screen is on, and have it set to device only when the screen is off. Another option is to have it set to battery saver/high accuracy when google now/maps is open and device only the rest of the time. I feel like this shouldn't be that hard but I messed around with it and got no where. Anyway, what are your guys' opinion about this strategy and would anyone be able to help me with implementing these tasks. Thanks!
 

Lokke9191

Senior Member
Nov 20, 2013
365
133
Glenview, IL
I wouldn't go the route of using tasker for your problem. And I would ditch that xposed module for wakelocks too. I run rooted with xposed on high accuracy at all times. My battery life is great. You need to find the source of your battery drain and eliminate it. Don't look for a bandaid fix using tasker. My guess is you have some rogue app killing your battery. Give us a list of all your apps, or delete them all, and install them one by one to track down the culprit. Also, are you running stock Rom and kernel? What other mods do you have?
 

PsychDrummer

Senior Member
Nov 29, 2012
732
110
I wouldn't go the route of using tasker for your problem. And I would ditch that xposed module for wakelocks too. I run rooted with xposed on high accuracy at all times. My battery life is great. You need to find the source of your battery drain and eliminate it. Don't look for a bandaid fix using tasker. My guess is you have some rogue app killing your battery. Give us a list of all your apps, or delete them all, and install them one by one to track down the culprit. Also, are you running stock Rom and kernel? What other mods do you have?

I can run the phone as normal today with location and everything on and post my BBS log after. Basically, when I'm at home the battery is great. However, ever since updating to the new google search app I've been having extreme wakelocks from the Npl whenever I would leave my house. Which is why I found a thread on xda that was talking about that exact wakelock. You're right though. I'm going to get rid of the app because it seemed weird. The wakelocks weren't showing up on BBS but I feel like it didn't get rid of them. Who knows though, maybe you're right and it is something else that's draining the battery which is why the wakelock app didn't help.

Anyway, I'm running stock ROM/kernel with xposed. I use greenify module, appOpsX, snapshare, gravity box, and gesture navigation module. With gravity box I just use custom quick settings, smaller nav bars, some status bar mods like the day and double tap to sleep. However, again I have had the same GB mods since before the drain. I use a pebble however I've never had a drain from that and I've been using it since Dec. Most of my apps are greenified including facebook, instagram, as well as all my music streaming apps. A lot of the google services I don't use are disabled like books/magazines/movies. I have snapchat, but I don't use it too much, and facebook messenger that I don't greenify. When I check GSam stats though, android system and kernel take the most battery, followed by music players if I was streaming music that day. The rest of the apps are way down the list.

I posted in the battery thread asking if anyone had the same problem with the wakelocks after having the latest google play services. I noticed mine is still 4.3 for some reason so I might just update manually from androidpolice and see if theres a difference. But yeah, I will keep this updated with todays logs.
 

Lokke9191

Senior Member
Nov 20, 2013
365
133
Glenview, IL
Try this. Use titanium backup to uninstall Google play services and Google search. Then launch maps, and reinstall both from the play store.
 

jj14

Senior Member
Mar 5, 2008
1,112
316
Another option is to have it set to battery saver/high accuracy when google now/maps is open and device only the rest of the time.

This is what I ended up doing. You will need the secure settings plugin for tasker.
Set up a new profile for application "Maps".
When on, launch task GPS On (Secure settings, configuration GPS enabled)
Exit task, launch task GPS On (Secure settings, configuration GPS disabled)

I used the app factory to create an app for this, and use that on my N5 and my second phone too. Works great. Enables GPS when I launch Maps for navigation, and switches to battery saving when I exit Maps
 
  • Like
Reactions: PsychDrummer

Aerowinder

Senior Member
Aug 11, 2012
3,322
1,329
I can run the phone as normal today with location and everything on and post my BBS log after. Basically, when I'm at home the battery is great. However, ever since updating to the new google search app I've been having extreme wakelocks from the Npl whenever I would leave my house. Which is why I found a thread on xda that was talking about that exact wakelock. You're right though. I'm going to get rid of the app because it seemed weird. The wakelocks weren't showing up on BBS but I feel like it didn't get rid of them. Who knows though, maybe you're right and it is something else that's draining the battery which is why the wakelock app didn't help.

Anyway, I'm running stock ROM/kernel with xposed. I use greenify module, appOpsX, snapshare, gravity box, and gesture navigation module. With gravity box I just use custom quick settings, smaller nav bars, some status bar mods like the day and double tap to sleep. However, again I have had the same GB mods since before the drain. I use a pebble however I've never had a drain from that and I've been using it since Dec. Most of my apps are greenified including facebook, instagram, as well as all my music streaming apps. A lot of the google services I don't use are disabled like books/magazines/movies. I have snapchat, but I don't use it too much, and facebook messenger that I don't greenify. When I check GSam stats though, android system and kernel take the most battery, followed by music players if I was streaming music that day. The rest of the apps are way down the list.

I posted in the battery thread asking if anyone had the same problem with the wakelocks after having the latest google play services. I noticed mine is still 4.3 for some reason so I might just update manually from androidpolice and see if theres a difference. But yeah, I will keep this updated with todays logs.

Just run device only all the time, like everyone else does. It's a problem with Google's code, and the same bad coding is clearly seen throughout their entire app lineup.
 

PsychDrummer

Senior Member
Nov 29, 2012
732
110
Try this. Use titanium backup to uninstall Google play services and Google search. Then launch maps, and reinstall both from the play store.

What would that do though?

This is what I ended up doing. You will need the secure settings plugin for tasker.
Set up a new profile for application "Maps".
When on, launch task GPS On (Secure settings, configuration GPS enabled)
Exit task, launch task GPS On (Secure settings, configuration GPS disabled)

I used the app factory to create an app for this, and use that on my N5 and my second phone too. Works great. Enables GPS when I launch Maps for navigation, and switches to battery saving when I exit Maps

Thanks! So, how would I set this up using device only/high accuracy? I'm also super new to tasker so if you don't mind I might PM you asking for help.

Just run device only all the time, like everyone else does. It's a problem with Google's code, and the same bad coding is clearly seen throughout their entire app lineup.

Well, I actually like to use maps and google now. However, I don't actually need the location on when I'm not using either of the two services which is why I wanted to setup tasker.
 

Lokke9191

Senior Member
Nov 20, 2013
365
133
Glenview, IL
It'll change them from being system apps to user apps. This has solved nlp wakelocks for many others experiencing the same problems.
 

jj14

Senior Member
Mar 5, 2008
1,112
316
Thanks! So, how would I set this up using device only/high accuracy? I'm also super new to tasker so if you don't mind I might PM you asking for help.

Sure.
It isn't that hard - install the secure settings plug in first, and when prompted, give it Superuser access. Then, create a new profile in tasker - call it whatever you want. Set up the profile for the application "Maps"

When Maps is launched, set it up to fire a new task (I called it GPS On) - this task just enables the GPS setting in the secure settings (under third party plugins)
GPS on -> high accuracy
GPS off -> battery saving mode

Set up an exit task (I called it GPS Off) - this turns the GPS settings in the secure settings off.
I can send you the apk if you want (but you don't really know me, so you probably shouldn't use an apk from a stranger! lol!), or you can try to import this attached xml into tasker (rename the file to remove the .txt extension - filename will be AutoGPS.prj.xml) - the xml option should be safe.

I haven't tried importing an xml, but it should be fairly straightforward (Save profiles in /sdcard/tasker/profiles and then, in tasker, long press the profiles "tab" and "import"). Before doing this, backup your existing profiles in tasker, just in case. Also, make sure you have secure settings set up before you import this.
 

Attachments

  • AutoGPS.prj.xml.txt
    4 KB · Views: 18
  • Like
Reactions: PsychDrummer

PsychDrummer

Senior Member
Nov 29, 2012
732
110
Sure.
It isn't that hard - install the secure settings plug in first, and when prompted, give it Superuser access. Then, create a new profile in tasker - call it whatever you want. Set up the profile for the application "Maps"

When Maps is launched, set it up to fire a new task (I called it GPS On) - this task just enables the GPS setting in the secure settings (under third party plugins)
GPS on -> high accuracy
GPS off -> battery saving mode

Set up an exit task (I called it GPS Off) - this turns the GPS settings in the secure settings off.
I can send you the apk if you want (but you don't really know me, so you probably shouldn't use an apk from a stranger! lol!), or you can try to import this attached xml into tasker (rename the file to remove the .txt extension - filename will be AutoGPS.prj.xml) - the xml option should be safe.

I haven't tried importing an xml, but it should be fairly straightforward (Save profiles in /sdcard/tasker/profiles and then, in tasker, long press the profiles "tab" and "import"). Before doing this, backup your existing profiles in tasker, just in case. Also, make sure you have secure settings set up before you import this.

Cool, thanks I will give it a try. And it would be the same if I want to have location on when using google search/now?
 

jj14

Senior Member
Mar 5, 2008
1,112
316
Cool, thanks I will give it a try. And it would be the same if I want to have location on when using google search/now?

Yes, it should be. But in my experience, I haven't found Google Search/Now really requiring high accuracy GPS level location for any of the features yet. It gets by fine with just battery saving mode. So, I only enabled this for the Maps application.

Actually, now that I think about it, I don't know how you'd enable it for Google Now - since it runs in the background to notify you about upcoming events. Since you aren't launching Google Now most of the times, I don't know how you'd set up Tasker to enable the high accuracy GPS for that (and it is possible that Google now using active GPS may be part of the battery drain issue - I don't know for sure)
 

PsychDrummer

Senior Member
Nov 29, 2012
732
110
Yes, it should be. But in my experience, I haven't found Google Search/Now really requiring high accuracy GPS level location for any of the features yet. It gets by fine with just battery saving mode. So, I only enabled this for the Maps application.

Actually, now that I think about it, I don't know how you'd enable it for Google Now - since it runs in the background to notify you about upcoming events. Since you aren't launching Google Now most of the times, I don't know how you'd set up Tasker to enable the high accuracy GPS for that (and it is possible that Google now using active GPS may be part of the battery drain issue - I don't know for sure)

I actually wanted to keep the device on "device only" location instead of battery saving. For Google now I wanted the traffic card, but I would only need it if I physically open google now. I don't really need the notification.
 

jj14

Senior Member
Mar 5, 2008
1,112
316
I actually wanted to keep the device on "device only" location instead of battery saving. For Google now I wanted the traffic card, but I would only need it if I physically open google now. I don't really need the notification.

To keep device only, you should use Location mode (in secure settings) and set it to Device only or whatever you need, instead of GPS.
Note that "Device only" still uses active GPS and "This mode may use more battery power and take longer to determine your location" (Ref: https://support.google.com/nexus/answer/3467281?hl=en)

The traffic card still works on "battery saving" because it uses cellphone triangulation, and shows you the traffic in your vicinity, and based on your destination.
 

PsychDrummer

Senior Member
Nov 29, 2012
732
110
To keep device only, you should use Location mode (in secure settings) and set it to Device only or whatever you need, instead of GPS.
Note that "Device only" still uses active GPS and "This mode may use more battery power and take longer to determine your location" (Ref: https://support.google.com/nexus/answer/3467281?hl=en)

The traffic card still works on "battery saving" because it uses cellphone triangulation, and shows you the traffic in your vicinity, and based on your destination.

I know, I have always used battery saving. The problem is that with battery saving, I'm having these extreme wakelocks and Google is constantly searching for my location which is what I think is the cause of the drain I'm having. I'm going to use my phone today by just using device-only location and see how the battery lasts. It should be much better since I'm hoping the phone will be deep sleeping longer. Basically, when I take my phone off the charger in the morning and I'm still at home for the first 2 hours of the day the standby time is great. It usually goes down 1-2% in those 2 hours even if I use the phone a little. However, once I leave the house is when I get constant wakelocks from location services and the battery stats to deplete a lot faster. I mean, I can still get through a day just because I don't use the screen a lot. I tend to only use about 1 hr 30 min on a regular day but I just want to play around with settings to see what works.If I can get the same standby time throughout the day that I get within the first two hours when im at home that would be great.
 

jj14

Senior Member
Mar 5, 2008
1,112
316
I know, I have always used battery saving. The problem is that with battery saving, I'm having these extreme wakelocks and Google is constantly searching for my location which is what I think is the cause of the drain I'm having. I'm going to use my phone today by just using device-only location and see how the battery lasts. It should be much better since I'm hoping the phone will be deep sleeping longer. Basically, when I take my phone off the charger in the morning and I'm still at home for the first 2 hours of the day the standby time is great. It usually goes down 1-2% in those 2 hours even if I use the phone a little. However, once I leave the house is when I get constant wakelocks from location services and the battery stats to deplete a lot faster. I mean, I can still get through a day just because I don't use the screen a lot. I tend to only use about 1 hr 30 min on a regular day but I just want to play around with settings to see what works.If I can get the same standby time throughout the day that I get within the first two hours when im at home that would be great.

That's strange. With battery saving mode, I get no wakelocks, which with device only or high accuracy, I used to get a lot of wakelocks by the location services.
But yes, no harm in trying out the options. Tasker+secure settings should be able to set up the battery saving or device only (as described above)
 

PsychDrummer

Senior Member
Nov 29, 2012
732
110
That's strange. With battery saving mode, I get no wakelocks, which with device only or high accuracy, I used to get a lot of wakelocks by the location services.
But yes, no harm in trying out the options. Tasker+secure settings should be able to set up the battery saving or device only (as described above)

You get Npl wakelocks? So far I haven't gotten it and that's the wakelock that usually keeps my phone awake for 2 hours or so. basically, I think the way it works is that the device only setting uses more battery when using apps that use location such as maps but when the apps are not in use it uses no battery on location.
 

jj14

Senior Member
Mar 5, 2008
1,112
316
You get Npl wakelocks? So far I haven't gotten it and that's the wakelock that usually keeps my phone awake for 2 hours or so. basically, I think the way it works is that the device only setting uses more battery when using apps that use location such as maps but when the apps are not in use it uses no battery on location.

No. Ever since I switched to battery saving (and tasker toggling to high accuracy when I use maps), I have no location based wakelocks (no NPL wakelocks)
 

PsychDrummer

Senior Member
Nov 29, 2012
732
110
No. Ever since I switched to battery saving (and tasker toggling to high accuracy when I use maps), I have no location based wakelocks (no NPL wakelocks)

Interesting, I've been having the opposite. I even took a screen shot of the wakelocks on the stock battery app where when the screen is off there's a huge amount of individual lines for awake (of course this is backed up by BBS). However when using device only the awake and screen on match almost perfectly.
 

jj14

Senior Member
Mar 5, 2008
1,112
316
Interesting, I've been having the opposite. I even took a screen shot of the wakelocks on the stock battery app where when the screen is off there's a huge amount of individual lines for awake (of course this is backed up by BBS). However when using device only the awake and screen on match almost perfectly.

Not sure why the difference, but regardless, as long as the individual 'fix' works, that's all that matters :)
 

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    Another option is to have it set to battery saver/high accuracy when google now/maps is open and device only the rest of the time.

    This is what I ended up doing. You will need the secure settings plugin for tasker.
    Set up a new profile for application "Maps".
    When on, launch task GPS On (Secure settings, configuration GPS enabled)
    Exit task, launch task GPS On (Secure settings, configuration GPS disabled)

    I used the app factory to create an app for this, and use that on my N5 and my second phone too. Works great. Enables GPS when I launch Maps for navigation, and switches to battery saving when I exit Maps
    1
    Thanks! So, how would I set this up using device only/high accuracy? I'm also super new to tasker so if you don't mind I might PM you asking for help.

    Sure.
    It isn't that hard - install the secure settings plug in first, and when prompted, give it Superuser access. Then, create a new profile in tasker - call it whatever you want. Set up the profile for the application "Maps"

    When Maps is launched, set it up to fire a new task (I called it GPS On) - this task just enables the GPS setting in the secure settings (under third party plugins)
    GPS on -> high accuracy
    GPS off -> battery saving mode

    Set up an exit task (I called it GPS Off) - this turns the GPS settings in the secure settings off.
    I can send you the apk if you want (but you don't really know me, so you probably shouldn't use an apk from a stranger! lol!), or you can try to import this attached xml into tasker (rename the file to remove the .txt extension - filename will be AutoGPS.prj.xml) - the xml option should be safe.

    I haven't tried importing an xml, but it should be fairly straightforward (Save profiles in /sdcard/tasker/profiles and then, in tasker, long press the profiles "tab" and "import"). Before doing this, backup your existing profiles in tasker, just in case. Also, make sure you have secure settings set up before you import this.