Navigation Apps Auto turn on/off GPS

Share and discuss your flows and ideas with other users.

Moderator: Martin

tphg
Posts: 57
Joined: 17 Apr 2017 05:31

Re: Navigation Apps Auto turn on/off GPS

Post by tphg » 30 Dec 2017 01:36

syndromtr wrote:a workaround for non-rooted systems: (use at your own risk! - read below - you can add delays and modify it after trigger...)

flow name : gps off
Trigger : App Task Ended : com.google.android.apps.maps (you can add other software as well, which needs GPS on)

Action : Set System Setting :
Secure
location_mode
0

Action : Set System Setting :
Secure
location_providers_allowed
<blank> (keep it blank)

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

flow name : gps on
Trigger : App Task Started : com.google.android.apps.maps (you can add other software as well, which needs GPS on)

Action : Set System Setting :
Secure
location_mode
3

Action : Set System Setting :
Secure
location_providers_allowed
network,gps

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

on my system (lenovo k5 note-no root-android 6) secure variable "location_mode" is not present, but only this way it toggles GPS (that variable is from nexus). So, in action, Set System Setting, you need to type it manually as "secure" and give values 0 for off - 3 for on.

what happens: when google map starts, if you double swipe to see quick settings, you'll notice GPS is disabled. but it really works. tested with other navigation-compass apps...

feedback is welcome
Thank you for making this thread alive.
I have tried to make the flow based on your instruction but unfortunately it still could not work on my phone, and it stuck at step of "location_mode" with value 3.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Navigation Apps Auto turn on/off GPS

Post by Desmanto » 08 Mar 2018 07:08

foogooa wrote:What about a https://mobile-spy-apps.com mobile recorder on Android?
It is possible to create it, but require a very long process. For a simple location variable logging, it just require 1 or 2 triggers with 1 script block. To sync the data, we can use periodic timer and upload the data to configured gdrive. Sending custom command can be done via sms or maybe whatsapp. But all require a very specific configuration on target device. It also depends on what are the things we want to log.

I ever think trying to create it. Since someone ever ask mea about it when I am still using tasker. It is easier now to do it in Automagic. But I still have at least 5 flows those I focus on. Will try to look at it when most of them have finished.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Thierry2064
Posts: 4
Joined: 13 Apr 2018 07:52

Re: Navigation Apps Auto turn on/off GPS

Post by Thierry2064 » 28 Apr 2018 17:35

Hi all, I did not succeed in making the non-root version work on Galaxy s9. Did anyone else try on Samsung? Just to know if I do something wrong or if the phone does not allow it...
However thanks for posting

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Navigation Apps Auto turn on/off GPS

Post by Desmanto » 28 Apr 2018 18:11

Have you granted Automagic the write secure setting permission in PC via adb? If already and the set system setting is executed properly, it seems the device doesn't reread the setting immediately. Some device only reread the settings database when you open up the settings - app. If that so, you need to use launch app setting after you have change the value and switch back to the navigation app again. But it will distract you for a while.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

tphg
Posts: 57
Joined: 17 Apr 2017 05:31

Re: Navigation Apps Auto turn on/off GPS

Post by tphg » 29 Apr 2018 00:36

Desmanto wrote:Have you granted Automagic the write secure setting permission in PC via adb? If already and the set system setting is executed properly, it seems the device doesn't reread the setting immediately. Some device only reread the settings database when you open up the settings - app. If that so, you need to use launch app setting after you have change the value and switch back to the navigation app again. But it will distract you for a while.
By the way, please could you share the command for granting Automagic the write secure setting permission in PC via adb, as well as commands for other permissions.
Since the time using Automagic, I have not granted any permission for it via ADB, just granted what Automagic asked during using.
Thanks in advance, Desmanto.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Navigation Apps Auto turn on/off GPS

Post by Desmanto » 29 Apr 2018 06:50

tphg wrote:By the way, please could you share the command for granting Automagic the write secure setting permission in PC via adb, as well as commands for other permissions.
Since the time using Automagic, I have not granted any permission for it via ADB, just granted what Automagic asked during using.
Thanks in advance, Desmanto.
For Write secure, It is already at my first post (in this thread). There is no other permission to grant anymore using adb, besides this write secure permission. Most of other permissions are granted thru the phone it self, or Automagic settings > Feature & Permissions.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Thierry2064
Posts: 4
Joined: 13 Apr 2018 07:52

Re: Navigation Apps Auto turn on/off GPS

Post by Thierry2064 » 29 Apr 2018 21:49

Desmanto wrote:Have you granted Automagic the write secure setting permission in PC via adb? If already and the set system setting is executed properly, it seems the device doesn't reread the setting immediately. Some device only reread the settings database when you open up the settings - app. If that so, you need to use launch app setting after you have change the value and switch back to the navigation app again. But it will distract you for a while.
Yes I granted the permission. Maybe I did something wrong though, as the setting does not change even after opening setting app.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Navigation Apps Auto turn on/off GPS

Post by Desmanto » 30 Apr 2018 18:12

Thierry2064 wrote: Yes I granted the permission. Maybe I did something wrong though, as the setting does not change even after opening setting app.
Try some other setting too, but be careful with values, as It may cause bootloop if set outside of the allowed value. Try Category : System, try something like volume_music_speaker and change it to a higher or lower value. Check (at volume setting) if it change the value after you execute it. Not all system setting can be changed using this method. And oh one more thing, try to go to app info of Automagic, and see if all permissions has been granted properly, especially Modify system setting.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

yxd0018
Posts: 85
Joined: 05 Dec 2018 15:14

Re: Navigation Apps Auto turn on/off GPS

Post by yxd0018 » 27 Jan 2019 22:25

on lineageOs 16 = android 9, I don't see location_mode in system setting. Anyone can share gps on/off script based on app launched? Thanks.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Navigation Apps Auto turn on/off GPS

Post by Desmanto » 28 Jan 2019 17:31

I don't have it anymore too. Starting from Oreo, the location_providers_allowed seems doesn't work anymore. I have to use root and use Set GPS State on/off. My location is on all the time, but at network mode. When using google maps and navigation apps, Set GPS State on will set it to high accuracy (using GPS). After 1 minute not using the maps, Set GPS state off will set it back to location battery saving mode. This happen from RR 6.2 Oreo 8.1 until now RR 7.0 Pie 9.0.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Post Reply