Home > Tips and Tricks

Automatically enable/disable location when opening/closing Maps

In this guide, we will show you the steps to automatically enable or disable GPS Location when opening or closing any Maps app on your Android device. Thanks to the open-source nature of the Android ecosystem, there are literally endless possibilities that one could explore. While some of them might require root, there are a plethora of other non-root alternatives that deserve your attention.

One such non-root approach is the ability to make your Android device automatically enable or disable GPS Location when opening or closing any Maps app. In order to get this job done, we will be using an automation app named MacroDroid. While Tasker could also do this job, but its UI might prove to be a little bit technical for some. So let’s opt for a simple and easy way of getting this job done.

Automatically enable/disable location when opening/closing Maps

Automatically enable location when opening Maps

While the process might look daunting at first, but it’s just a one-time process. Moroever, the below in-depth explanation along with the screenshots should streamline the entire process.

  1. Download and install the MacroDroid App from Play Store.
  2. Then launch it and tap on Add Macro > Add Triggers > Application
  3. Application Launched/Closed > Application Launched > OK.
  4. Select Applications > OK > Select your maps app > OK.
  5. You will get an accessibility request > tap OK > select MacroDroid.
  6. Enable the toggle next to MacroDroid > tap Allow > go back to the app.
  7. Now go back to your Macro > Add Triggers > Application >Triggers.
  8. Application > Application Launched/Closed > Application Closed > OK.
  9. Select Applications > OK > Select your maps app > OK.Automatically enable location when opening Maps
  10. Add Actions > Location > Location Mode > Location Service On > OK.
  11. Now enable USB Debugging on your device and connect it to your PC via a USB cable.
  12. Then download Android SDK Platform Tools and extract it onto your PC.
  13. Now launch CMD inside platform-tools and execute the below command
    adb shell pm grant com.arlosoft.macrodroid android.permission.WRITE_SECURE_SETTINGS

    Automatically enable location when opening Maps

  14. Tap on Location Service On > Add Constraint > Device State.Automatically enable location when opening Maps
  15. Application Running > Running in Foreground > OK > Select Maps > OK.
  16. Tap on Location Service Off > Add Constraint > Device State >
  17. Application Running > Not in Foreground > OK > Select Maps > OK.
  18. Now tap on the Location Service On Action and select Add Constraint.
  19. Device State > Application Running > Running in Foreground > select Maps > OK.
  20. Then tap on the Location Service Off Action and select Add Constraint.
  21. Device State > Application Running > Not in Foreground > Select Maps > OK.
  22. Finally, give your macro a name and save it. It will now run in the backend and do its job.Automatically enable location when opening Maps

That’s it. These were the steps to automatically enable or disable GPS Location when opening or closing any Maps app on your Android device. If you have any queries concerning the aforementioned steps, do let us know in the comments. We will get back to you with a solution at the earliest.


Share: