Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,812,386 Members 38,981 Now Online
XDA Developers Android and Mobile Development Forum

[APP][Battery Saving] NFC Auto ON/OFF - GPS Auto ON/OFF [21 Jul 14]

Tip us?
 
bmdjdd1105
Old
(Last edited by bmdjdd1105; 22nd July 2014 at 04:25 PM.)
#1  
Account currently disabled - OP
Thanks Meter 14
Posts: 17
Join Date: Jul 2014

 
DONATE TO ME
Default [APP][Battery Saving] NFC Auto ON/OFF - GPS Auto ON/OFF [21 Jul 14]

Tasker and Secure Settings


TaskerSecure Settings



I use these 2 apps to simplify the process of using Google Wallet and Maps as well as to save battery. Additionally, leaving NFC on is more of a security risk anyway. What this guide will show you is how to set up Tasker to enable NFC automatically for you when you launch Google Wallet and to enable the GPS when you use Google Maps. Whats cool is as soon as you exit the each program, it will turn NFC off or GPS off. It's great because it eliminates various annoying steps.


BEFORE YOU BEGIN, INSTALL BusyBox BY STERICSON!!

 



INSTRUCTIONS:

1. Download and Install Tasker and Secure Settings
2. Open Secure Settings
3. Once open, click System+ at the Top - See below

 
System +

4. You should now be at the following Screen where it says Disabled with an X at the bottom - See below

 

5. Click Disabled to Enable this module (This requires root and if you have SuperUser or SuperSU, you will be prompted to grant Root Access)

 
Super User Request

6. Grant Root Permissions if this applies
7. If all Goes well, the module will be enabled - See below

 

8. Reboot the phone
9. Upon complete reboot process, open tasker
10. Click on Tasks - See below

 

11. Click the + at the bottom of the screen
12. Name the task NFC On as seen below

 

13. You will now be at the task Edit Screen, hit the + at the bottom again
14. You will see a Select Action Category Box -> select Plugin - see below

 

15. You will see Select Plugin Action Category Box -> select Secure Settings - see below

 

16. The Action edit Screen will open -> Click the pencil in the upper right corner - see below

 

17. All Actions will open up -> click System+ Actions - see below

 

18. Scroll down the list and click NFC
19. Make sure on is selected and hit the save button to the left the X - see below

 

20. You will come back to the task Edit Page - see below

 

21. Hit the softui back button 2x at the bottom of the screen until you see the Task in the list that you just created - (YOU WILL ONLY SEE NFC ON BECAUSE THATS ALL YOU CREATED SO FAR) - see below

 

22. Reapeat the same steps to Create NFC Off, GPS On and GPS On. Ensure you select the proper state such as on and off as it applies - see below

 
ON:





OFF:


32. Now you will Create the Profiles, in other words, picking the Apps that you want to use
33. Go to the profiles Tab of tasker - see below

 

34. A Box will pop up -> select Application - see below

 

35. Select Google Wallet for the NFC On/Off Tasks - see below

 

36. Hit the softui Back button at the bottom and a task window will appear - see below

 

37. Select NFC On from the list and you should see the below output

 

38. Long Press on NFC On and a Menu will pop up - see below

 

39. Click Add Exit task and select NFC Off
40. You will now have the output as seen below

 

41. Make Sure the profile is on and you are complete!!
42. If you would like to add Maps complete the same steps as above, if you are good with what you have then you are done!!




It looks like a lot of steps but trust me its not that bad. Its easy once you get used to it!!! Enjoy and if this helped you hit the thanks button!
The Following 6 Users Say Thank You to bmdjdd1105 For This Useful Post: [ Click to Expand ]
 
nest75068
Old
(Last edited by nest75068; 22nd July 2014 at 02:48 PM.)
#2  
nest75068's Avatar
Senior Member
Thanks Meter 120
Posts: 903
Join Date: Feb 2012
Location: Dallas
You forgot the part that it requires Busy Box as well for Secure Settings - Just FYI

Also if you want a more accurate location based for Maps, why not enable Location - High Accuracy and then Battery saving as the off action?
Mine
LG G3 rooted w/ Towelroot - running Xposed framework and G3 Tweaks

Wife's
The Following User Says Thank You to nest75068 For This Useful Post: [ Click to Expand ]
 
bmdjdd1105
Old
#3  
Account currently disabled - OP
Thanks Meter 14
Posts: 17
Join Date: Jul 2014

 
DONATE TO ME
Quote:
Originally Posted by nest75068 View Post
You forgot the part that it requires Busy Box as well for Secure Settings - Just FYI

Also if you want a more accurate location based for Maps, why not enable Location - High Accuracy and then Battery saving as the off action?
Thanks for pointing that out, I added it to the OP
 
ohmegosh
Old
(Last edited by ohmegosh; 25th July 2014 at 04:41 PM.)
#4  
Junior Member
Thanks Meter 1
Posts: 25
Join Date: Feb 2013
Problem with just turning the GPS off as soon as you switch away from maps to something else, when you switch back you'll get an 'enable gps' message from maps.

Here was my solution:


Tasks:
'GPS on'
1. Variable Set
%GPSStateWanted, 1
2. If %GPS ~ Off
3. GPS on (use secure settings for this)
4. Flash
GPS on
5. Else
6. Flash
GPS was already on.
7. End if


Task: GPS off
1. Variable Clear
%GPSStateWanted
2. If %GPS ~ On
3. Flash
GPS countdown started
4. For
%countdown, 69:0
5. If %GPS ~ On
6. If %GPSStateWanted = 0
7. Flash
GPS countdown %countdown IF %countdown < 4
8. Wait 0, 1, 0, 0 (1 sec)
9. End if
10. End if
11. End if
12. If %GpsStateWanted != 1
13. GPS Off (use secure settings)
14. Flash
GPS off
15. Else
16. Flash
GPS countdown: GPS still needed
17. End if
18 End if


After testing manually that GPS on does turn on the GPS, and that GPS off then does turn the GPS off after a minute or so, then create a profile

Profile:
'GPS On'
App selection: Maps, Naviation, Tripadvisor
Green arrow action: GPS on
Red Array action: GPS off


Reason I didn't have a single wait is that I wanted the abort countdown to happen immediately otherwise you run the risk of things getting confused (e.g. a wait 69 would just potentially have GPS off/on/off/on all queued up - I want tasks to stop asap so that the next can trigger).
 
nest75068
Old
#5  
nest75068's Avatar
Senior Member
Thanks Meter 120
Posts: 903
Join Date: Feb 2012
Location: Dallas
Quote:
Originally Posted by ohmegosh View Post
Problem with just turning the GPS off as soon as you switch away from maps to something else, when you switch back you'll get an 'enable gps' message from maps.

Here was my solution:


Tasks:
'GPS on'
1. Variable Set
%GPSStateWanted, 1
2. If %GPS ~ Off
3. GPS on (use secure settings for this)
4. Flash
GPS on
5. Else
6. Flash
GPS was already on.
7. End if


Task: GPS off
1. Variable Clear
%GPSStateWanted
2. If %GPS ~ On
3. Flash
GPS countdown started
4. For
%countdown, 69:0
5. If %GPS ~ On
6. If %GPSStateWanted = 0
7. Flash
GPS countdown %countdown IF %countdown < 4
8. Wait 0, 1, 0, 0 (1 sec)
9. End if
10. End if
11. End if
12. If %GpsStateWanted != 1
13. GPS Off (use secure settings)
14. Flash
GPS off
15. Else
16. Flash
GPS countdown: GPS still needed
17. End if
18 End if


After testing manually that GPS on does turn on the GPS, and that GPS off then does turn the GPS off after a minute or so, then create a profile

Profile:
'GPS On'
App selection: Maps, Naviation, Tripadvisor
Green arrow action: GPS on
Red Array action: GPS off


Reason I didn't have a single wait is that I wanted the abort countdown to happen immediately otherwise you run the risk of things getting confused (e.g. a wait 69 would just potentially have GPS off/on/off/on all queued up - I want tasks to stop asap so that the next can trigger).
Why not just use secure settings to set it to turn on HighAccuracy lcoation mode and then turn it off? This way you avoid the whole GPS issue since it can rely on other factors to pinpoint location in the case that GPS hasn't locked on yet.

That's what I'm using and never have an issue with maps saying enable GPS when I switch from Maps to any app and then back
Mine
LG G3 rooted w/ Towelroot - running Xposed framework and G3 Tweaks

Wife's
 
ohmegosh
Old
#6  
Junior Member
Thanks Meter 1
Posts: 25
Join Date: Feb 2013
Quote:
Originally Posted by nest75068 View Post
Why not just use secure settings to set it to turn on HighAccuracy lcoation mode and then turn it off? This way you avoid the whole GPS issue since it can rely on other factors to pinpoint location in the case that GPS hasn't locked on yet.

That's what I'm using and never have an issue with maps saying enable GPS when I switch from Maps to any app and then back
For navigation, if you aren't in either gps or high accuracy then the navigation will get cancelled with warnings.
 
ZenithHammerhead
Old
#7  
Member
Thanks Meter 32
Posts: 85
Join Date: Nov 2013
Location: Mason, Ohio
I've had tasker for a while now, and only made simple tasks here and there. I control gps and the such with an app called trigger.

I do remember that there was a way to export your profiles out of tasker. If you could do that, and then post it here, it could make it a lot easier for users to benefit from your work.

I'm all for tapping away at my phone getting the settings working, but hey, not everyone will be down with that..
 
GroovyGeek
Old
#8  
Senior Member
Thanks Meter 76
Posts: 499
Join Date: Oct 2010
The GPS part of this is kinda pointless. Android already puts GPS to sleep after a some period if no app is using it. If you want to save battery you are probably better off with Greenify - force it to shut down Maps, don't use Google now, etx

Tags
battery saver, gps, nfc, secure settings, tasker
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Change Your Samsung Galaxy S2’s Dialer Background in Real Time

As with anything, if youve looked at something long enough, things can … more

Increase Your Multitasking Workflow with C-Floating Windows

Technology has put life on the fast track. Lazy, relaxed days have turned into … more

Compile Your Own Kernel From Source with Comprehensive Tutorial

One glance at any developer section of any device forum on XDA and youll find … more

WowWee Mip – Android Accessory Review – XDA Developer TV

The holidays will be here in no time, so why not start thinking about … more