Navigation Apps Auto turn on/off GPS

Share and discuss your flows and ideas with other users.

Moderator: Martin

anuraag
Posts: 371
Joined: 24 Jan 2015 02:06

Re: Navigation Apps Auto turn on/off GPS

Post by anuraag » 30 Aug 2017 10:00


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

Re: Navigation Apps Auto turn on/off GPS

Post by tphg » 30 Aug 2017 14:57

anuraag wrote:Take a look at following help
http://automagic4android.com/en/help/co ... em_setting
Thank you. I'll try it.

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

Re: Navigation Apps Auto turn on/off GPS

Post by Desmanto » 30 Aug 2017 16:08

anuraag wrote:Non root users can use builtin secure setting of automagic to toogle gps.
Thanks for the reminder. I almost forgot that we can use that.
tphg wrote: Sounds interesting for non-root users. I have LG G4 with Marshmallow that there is no way to root it so far.
Please could you give more detail instruction on how to do it.
Thanks in advance.
I have update the OP with the new flow for non root user, including the instruction to use it. ;)
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 » 31 Aug 2017 03:39

Desmanto wrote:I have update the OP with the new flow for non root user, including the instruction to use it. ;)
You always give very detail instruction for the newbie like me could understand. Thanks a lot.
I have tried your flow for non-root, but it works only if I change the value of providers_allowed to from network,gps to +gps.
Similar for turning off GPS, I changed that value to -gps
Regarding ADB, I knew how to do as I've ever done that when installing Greenify.
Then it works well: turns on GPS when open Maps and Here, and turns off when close them.
However, the problem is that even GPS is already turned on by Automagic, but the apps still find it does not turn on yet and still ask for turning GPS on, then the apps could not find my current location.
So I think the phone must be rooted to use this function.

anuraag
Posts: 371
Joined: 24 Jan 2015 02:06

Re: Navigation Apps Auto turn on/off GPS

Post by anuraag » 31 Aug 2017 04:45

tphg wrote:However, the problem is that even GPS is already turned on by Automagic, but the apps still find it does not turn on yet and still ask for turning GPS on, then the apps could not find my current location.
So I think the phone must be rooted to use this function.
If you expend that message then you will notice that it is asking for turning on wifi scanning and not gps.

I have attached a flow which will enable wifi scanning so that you don't need to give extra permission.

Edit: updated my flow.
Attachments
flow_group_Gps_20200223_135625.xml
(14.01 KiB) Downloaded 1038 times
Screenshot_20170831-100745.png
Screenshot_20170831-100745.png (69.18 KiB) Viewed 31941 times
Last edited by anuraag on 23 Feb 2020 08:29, edited 3 times in total.

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

Re: Navigation Apps Auto turn on/off GPS

Post by tphg » 31 Aug 2017 06:04

anuraag wrote:If you expend that message then you will notice that it is asking for turning on wifi scanning and not gps.

I have attached a flow which will enable wifi scanning so that you don't need to give extra permission.
Thank you @anuraag, but I always manually turn on wifi before open Maps app.
Anyway, let me try your flow and feedback later.

anuraag
Posts: 371
Joined: 24 Jan 2015 02:06

Re: Navigation Apps Auto turn on/off GPS

Post by anuraag » 31 Aug 2017 06:25

@tphg
Its not turning on wifi.
Its asking for turning on wifi scanning which is available under location setting
Attachments
Screenshot_20170831-120524.png
Screenshot_20170831-120524.png (74.67 KiB) Viewed 31926 times

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

Re: Navigation Apps Auto turn on/off GPS

Post by tphg » 31 Aug 2017 08:18

anuraag wrote:@tphg
Its not turning on wifi.
Its asking for turning on wifi scanning which is available under location setting
Yes, I understand.
I have tried your flow but the problem still exists, even with Here map which is working in offline mode.
And I notice if I did not manually turn on wifi, Automagic could not turn it on by itself.
It seems there must be an ADB command to grant permission for Wifi together with GPS.

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

Re: Navigation Apps Auto turn on/off GPS

Post by Desmanto » 31 Aug 2017 17:13

Probabaly Automagic is late in detecting the app task started at your phone. While the app detect GPS is off faster than this delay.

Do you grant Automagic in Settings - Apps with Usage Access? Probably that can speed it up a bit. At mine, it doesn't make difference though. Make sure you enable automagic services at nofication bar, make it as the priority.

I try to check the detection speed of the app. Opening small apps such as Disk Usage only takes around 700 ms. Initial start might jump to 1300 ms, but it will average to 700 ms after cached. While bigger one may average up to 1 second. Google map probably loads a lot of things, initial startup require up to 7 seconds to be detected by automagic, while subsequent launch still need 1,1 - 1,3 seconds.

I have flow to open bluetooth when I launched Mi Fit. Sometimes the flow with App Task Started is too slow to detect it as well, so I have to manually turn on the bluetooth. I put a control UI in case it ask for turning on bluetooth. If the apps keep nagging about turning on gps, try to find the setting to disable this. Your GPS will be on, but a little too late. Probably because using set system setting, which takes more time to be detected by the system.

The workaround for this slow detection is to to make shortcut to launch the selected nav app from automagic. Someone ever made a similiar task, which use Input Dialog - Single Choice Menu to select the Nav app. Using that way, the GPS will always on before the app was launched. You can still keep the app task started, to make sure after the initial launch, switching back thru the app will still reset the timer.

Root solution
The ultimate solution for root user is to use Xposed Module - AppContext. This will hook app detection directly to the framework. Automagic can't do that since it require xposed, only small percentage users use it. To implement that will require a lot of time, which I prefer to have it spent on other features those will benefit more users.

I have tested in several occassion, initial startup may vary. For example, google maps which need 7 seconds, only require not more than 3 seconds using AppContext. While for average detection after cached, require about 600 ms less that automagic's built-in App Task Started. So Google map which average at 1,1 - 1,3 seconds, now only require 500-700 ms. For other small apps, the difference is more significant. Disk usage which average at 700 ms, now only 200 ms using App Context. Calendar average at 850 ms, now only 250 ms.
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 » 01 Sep 2017 02:37

@Desmanto
Understand that nav apps couldn't detect GPS status probably due to delay reaction from Automagic. I have granted all permissions for Automagic to make it having priority in all tasks.
And you have recommended a good idea of making a shortcut for launching nav app, then we can set device to turn on GPS before open nav app.
Let me try to do that way when having free time.
Anyway thank all of you for participating and contributing to this thread.

Post Reply