Page 3 of 7

Re: Navigation Apps Auto turn on/off GPS

Posted: 01 Sep 2017 09:24
by Desmanto
I have updated the flow to use input dialog to select the app. Check it out at the OP. ;)

Re: Navigation Apps Auto turn on/off GPS

Posted: 01 Sep 2017 14:46
by tphg
Desmanto wrote:I have updated the flow to use input dialog to select the app. Check it out at the OP. ;)
Thank you.
I've just tried it. Problem is still the same: nav app could not detect GPS status that is turned on.
Let me learn then try modifying the flow as per your advice for option 2.

Re: Navigation Apps Auto turn on/off GPS

Posted: 01 Sep 2017 15:54
by Desmanto
I have started to wonder if the Set System Setting really turn on the GPS at your phone.

Try the action separately in another flow, copy this same Set System Setting to another new flow and put the condition Location enabled : GPS at the bottom of Set System Setting.
Use debug dialog or notification on screen after the condition to check if the GPS is really on.
Try to put sleep 1 second between the Set System Setting and condition Location Enabled, then try to change to 2 seconds, 3, 4, 5 until you got the correct time.

Set System Setting
v
Sleep
v
Location Enabled : GPS
v (true)
Debug Dialog

Re: Navigation Apps Auto turn on/off GPS

Posted: 02 Sep 2017 01:29
by tphg
Desmanto wrote:I have started to wonder if the Set System Setting really turn on the GPS at your phone.

Try the action separately in another flow, copy this same Set System Setting to another new flow and put the condition Location enabled : GPS at the bottom of Set System Setting.
Use debug dialog or notification on screen after the condition to check if the GPS is really on.
Try to put sleep 1 second between the Set System Setting and condition Location Enabled, then try to change to 2 seconds, 3, 4, 5 until you got the correct time.

Set System Setting
v
Sleep
v
Location Enabled : GPS
v (true)
Debug Dialog
Yes, the Set System Setting really turn on the GPS at my phone, as I swiped down the notification bar and checked GPS status right after navi app opened.

Re: Navigation Apps Auto turn on/off GPS

Posted: 02 Sep 2017 06:03
by Desmanto
You should check the delay then. Check how many seconds does it take until GPS is detected as on.

Re: Navigation Apps Auto turn on/off GPS

Posted: 02 Sep 2017 06:58
by tphg
Sorry how to check delay time, does it show in Automagic log?
Forgot to let you know that, when using your flow I had to change the value from network,gps to +gps, otherwise GPS wouldn't turn on.
I have just tried again, and now Automagic flow is automatically turned off by device with error notification that showed "emergency ended" and that flow changed its color to red in Automagic app screen.
Can you analyze the problem if I send you the log created by Automagic?

Re: Navigation Apps Auto turn on/off GPS

Posted: 02 Sep 2017 07:39
by Desmanto
At my previous post, which tell you to set the sleep in between. There is a better way to test it though, but I planned to make it perfect and share it as a flow. It is better you just copy that set system setting, and put it after the input dialog. Then from Set system setting, branch out to 3 expression which lead to launch app.

For value change, it is no problem, as long as it turn on/off the GPS.

That emergency stop is automagic feature to prevent run-away flow (flow running continuously and no escape/ending condition). Usually happen in loop or trigger which are executed too often. By default, it is 60, means 60 elements execution, each condition or action counted as 1. If there are 60 elements executed from that flow within a minute, the flow will hit emergency stop and disabled immediately.

It is OK, just reenable it again. It means you test (execute) the flow too often within that minute. 60 is enough in most case, you don't trigger on of your flow hundreds of time within a minute right? Except in flow where there are loops and frequent trigger, then we should raise this value.

roll the ball

Posted: 28 Dec 2017 08:17
by rolltheballaz
Thanks for sharing.I found a lot of interesting information here. A really good post, very thankful and hopeful that you will write many more posts like this one.
- slope game - slope game
- slope game - slope game

Re: Navigation Apps Auto turn on/off GPS

Posted: 29 Dec 2017 18:18
by syndromtr
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

Re: Navigation Apps Auto turn on/off GPS

Posted: 29 Dec 2017 18:25
by Desmanto
At some phone, certain system setting value won't sync properly to the quick setting or the toggle if the value modified directly using Set system setting.
At mine, this GPS works. But airplane mode won't work.
Set the airplane mode to 1, the quick setting shows it is on; but airplane mode is not on!
When I tap the airplane mode to turn it off, the icon changed to off, and airplane mode is still off.
Tap again, then icon sync properly now, icon on, airplane mode also on.

So can't guarantee it will work at all phone, but maybe most can. In your case, the real GPS is on, but the quick setting still off (the reverse of my airplane mode :))