Toggle Location

227 views
Skip to first unread message

Thom Little

unread,
Apr 4, 2017, 1:58:44 PM4/4/17
to Tasker
Is there a method to toggle Location On/Off in 4.4,4. 6.0.1, and 7.0 when un-root-ed?

I almost always have Location Off to conserve battery.  It would be great if I could toggle it on, take a picture, and toggle it off to add a Geo Tag to the image.

... Thom

Rich Belthoff

unread,
Apr 5, 2017, 12:59:06 PM4/5/17
to Tasker
Try the SecureTask app in the play store. It supposedly supports this without root. You may have to do a factory reset to get it to work, though. Otherwise, I think the only option to change location is to root.

Thom Little

unread,
Apr 5, 2017, 1:50:24 PM4/5/17
to Tasker
Thank you for the response.

Unfortunately the control of Location is in the System+ area of Secure Settings and that area requires root.

I have also tried AutoInput and can get only as far as the display of the dropdown with the Location icon.  I then need to tap the icon and respond to an authorization question.

... Thom 

Marta Hintz

unread,
Apr 5, 2017, 3:24:47 PM4/5/17
to Tasker

Jay M

unread,
Apr 6, 2017, 1:36:51 AM4/6/17
to Tasker

com.google.android.gms.location.settings.GOOGLE_LOCATION_SETTINGS

This in a send Intent action should launch location settings, not what the op needs but sure someone will find it useful.


--
You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/tasker.
For more options, visit https://groups.google.com/d/optout.
--

Jay M ︻芫══一

Thom Little

unread,
Apr 6, 2017, 2:21:01 AM4/6/17
to Tasker
Marta -- am I safe in assuming that the SecureTask solution is for native Tasker only and cannot be in a Factory kid?  I need to have if in the Factory created apk.

Jay -- the GOOGLE LOCATION SETTINGS is interesting.  Using AutoInput/Global Actions/Quick Settings will actually bring you one click closer to setting it.

... Thom

John Doe

unread,
Apr 6, 2017, 7:44:21 AM4/6/17
to Tasker
@Rich For the secure settings action no reset is required.
@Thom If you need this feature in a kid app I suggest you to avoid plugin and to use this solution: https://www.reddit.com/r/tasker/comments/4zsi0e/project_share_toggle_settings_eg_location_mobile/

Dale Smith

unread,
Apr 6, 2017, 8:37:37 AM4/6/17
to Tasker
Here's how I do it with AutoInput. Samsung Galaxy S5 6.0.1.

GPS Toggle (12)
A1: Variable Set [ Name:%gps To:%GPS Recurse Variables:Off Do Maths:Off Append:Off ]
A2: AutoInput Global Action [ Configuration:Action: Open Notifications Timeout (Seconds):20 ]
A3: Wait [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ]
A4: AutoInput Action [ Configuration:Type: Text
Value: Location
Action : Click Timeout (Seconds):20 ]
A5: If [ %gps ~ off ]
A6: AutoInput Action [ Configuration:Type: Text
Value: Apps
Action : Scroll Forward Timeout (Seconds):20 ]
A7: AutoInput Action [ Configuration:Type: Text
Value: AGREE
Action : Click Timeout (Seconds):20 ]
A8: End If
A9: AutoInput Global Action [ Configuration:Action: Back Timeout (Seconds):20 ] If [ %noback !Set ]

Thom Little

unread,
Apr 7, 2017, 2:21:59 PM4/7/17
to Tasker
Thanks everyone for the leads and ideas.

The following is running from a kid on a Droid Turbo under 6.0.1 and a Droid Turbo 2 under 7.0 ...

tlaLocation (629)
A1: Variable Set [ Name:%tmp To:%GPS Recurse Variables:Off Do Maths:Off Append:Off ]
A2: AutoInput Global Action [ Configuration:Action: Quick Settings Timeout (Seconds):20 ]
A3: Wait [ MS:500 Seconds:0 Minutes:0 Hours:0 Days:0 ]

A4: AutoInput Action [ Configuration:Type: Text
Value: Location
Action : Click

Is Tasker Action: false
Check Screen State: false Timeout (Seconds):20 ]
A5: If [ %tmp ~ off ]


A6: AutoInput Action [ Configuration:Type: Text

Value: Agree
Action : Click
Is Tasker Action: false
Check Screen State: false Timeout (Seconds):20 ]
A7: Wait [ MS:500 Seconds:0 Minutes:0 Hours:0 Days:0 ]
A8: If [ %SDK ~ 23 ]
A9: AutoInput Action [ Configuration:Type: Text
Value: Agree
Action : Click
Is Tasker Action: false
Check Screen State: false Timeout (Seconds):20 ]
A10: Wait [ MS:500 Seconds:0 Minutes:0 Hours:0 Days:0 ]
A11: End If
A12: Else
A13: AutoInput Global Action [ Configuration:Action: Back Timeout (Seconds):20 ]
A14: Wait [ MS:500 Seconds:0 Minutes:0 Hours:0 Days:0 ]
A15: AutoInput Global Action [ Configuration:Action: Back Timeout (Seconds):20 ]
A16: End If


... Thom 

Robert Ryan

unread,
Apr 19, 2017, 10:50:01 PM4/19/17
to Tasker
Sorry for the late reply, but that's way more complicated than you need. This task also toggles GPS without all the extra steps:

test (65)

A1: Location Settings

A2: AutoInput UI Query
Configuration: App
Package: com.android.settings
Variables: com.android.settings:id/switch_widget=:=status
Timeout (Seconds): 20

A3: AutoInput Action
Type: Id
Value: com.android.settings:id/switch_bar


Action : Click
Timeout (Seconds): 20

A4: AutoInput Action
Type: Text
Value: agree


Action : Click
Timeout (Seconds): 20

If %status ~ off

A5: AutoInput Global Action

Thom Little

unread,
Apr 23, 2017, 9:14:37 AM4/23/17
to Tasker
That is a very interesting solution and I have been playing with it or a while.

There is one new hiccup.  When turning GPS on there sometimes is a second dialog with the title ...
Improve location accuracy?
... and it has two options ...
DISAGREE and AGREE.

How can I test for the existence of this dialog so I can respond when running on a phone that requites it?

My current draft runs fine if the dialog is required.  I need to remove A6 when it is not required.

tlaLocation (649)
A1: Location Settings
A2: AutoInput UI Query [ Configuration:Only Visible: false
Only Clickable: false
App Package: com.android.settings
Check Screen State: false
Variables: status Timeout (Seconds):20 ]
A3: AutoInput Action [ Configuration:Type: Id


Value: com.android.settings:id/switch_bar
Action : Click

Is Tasker Action: false
Check Screen State: false Timeout (Seconds):20 ]

A4: If [ %status ~ off ]
A5: AutoInput Action [ Configuration:Type: Text
Value: agree
Action : Click


Is Tasker Action: false
Check Screen State: false Timeout (Seconds):20 ]

A6: AutoInput Action [ Configuration:Type: Text
Value: agree
Action : Click


Is Tasker Action: false
Check Screen State: false Timeout (Seconds):20 ]


A7: End If
A8: AutoInput Global Action [ Configuration:Action: Back Timeout (Seconds):20 ]


... Thom

Dale Smith

unread,
Apr 24, 2017, 10:43:32 AM4/24/17
to Tasker
Ok this is as simple as I can make it. I never get asked about accuracy. It may be one of those don't ask again questions.

GPS Toggle (55)
A1: Variable Set [ Name:%gps To:%GPS Recurse Variables:Off Do Maths:Off Append:Off ]
A2: AutoInput Global Action [ Configuration:Action: Quick Settings Timeout (Seconds):20 ]
A3: AutoInput Action [ Configuration:Type: Text
Value: Location


Action : Click Timeout (Seconds):20 ]

A4: AutoInput Action [ Configuration:Type: Text
Value: AGREE
Action : Click Timeout (Seconds):20 ] If [ %gps ~ off ]
A5: AutoInput Global Action [ Configuration:Action: Back Timeout (Seconds):20 ] If [ %gps ~ on ]

Thom Little

unread,
Apr 24, 2017, 2:17:42 PM4/24/17
to Tasker
That is interesting.  Thank you.  I think you  need to add an A6 that is identical to A5.

The added precision prompt appears a number of times (I did not count them) and then it stops appearing.  20?40?

This operates correctly if I am in the task and just run it.  If I select the name of the task and run it then it hangs.  If I execute it from a widget it hangs.

If there I another TASK in Tasker that is monitoring and responding to the same elements then it gets invoked when this TASK is invoked any way other than from the very inside method.

Conclusion ... AutoInput has some problems segregating one TASK from another.

My original goal was to have a kid that could run on any in-root-ed device without Tasker and without a plug-in that would toggle Location.  It does not seem possible. 

... Thom

Reply all
Reply to author
Forward
0 new messages