16

Can I have Location services turn itself off automatically after a certain time is reached (let's say 10 minutes)? I normally leave it off save for some applications (Maps, etc) but sometimes I forget to turn it off, and it's a big battery drain.

17

That might be solved using one of the many apps. I myself prefer here, but YMMV (and Tasker doesn't come for free) – might be capable of the same.

What I do here is creating a profile like this:

  • Condition: App (select the apps you want to use GPS with)
  • Task: GPS On
  • optional exit task: GPS Off

That way GPS by default is off, but automatically gets turned on whenever you launch one of the selected apps and have them running in foreground. It would automatically be turned off once you exit that app, or have any other app running in foreground. The "exit task" is optional as Tasker restores the conditions from before the profile became active.

For other alternative automation apps, you're also welcome to take a look at my list here.

  • Well, I have a Google play store gift card lying around somewhere, with nothing else in mind to buy, so I can certainly try it out! Thanks! – Kaizerwolf Jun 8 '15 at 15:39
  • 2
    In that case: Go on, you certainly won't regret it! For more ideas on what you can do with it (besides making coffee, starting your car, and whatsnots), be welcome to take a look at my collection of Tasker resources. You'll certainly find the linked tutorials helpful – and the listed ideas interesting (and no, I wasn't kidding with "starting your car" – I'm just not entirely sure for the coffee ;) – Izzy Jun 8 '15 at 15:44
7

As Izzy said in the answer, Tasker is a great choice but it's not free for anyone. I tried AutomateIt(Free) and it gets the job done.

Edit: This answer is successfully tested on Android 4.2.1, without giving root access to AutomateIt. However, on Android 4.4.2, COS12 (Android 5.0.2) and CM12.1 (Android 5.1.1, build: YOG7DAO1K6), the relevant options were not visible until I restarted the app with root access. This fact came to my notice through this comment by jonatr.

  1. Install and launch AutomateIt.
  2. Go to My RulesAll, and see if you need any predefined rules. If you don't then either disable or delete by tapping each entry once and selecting the desired option.
  3. Tap + corresponding to My Rules tab → Application Status Trigger → tap lens icon and choose your app (Maps here) → check Application ActivatedNextEnable/Disable GPS ActionEnable GPSNext → choose Default or No (to show or not, a toast whenever automation will be triggered) → tap floppy icon at the top to save everything.
  4. Repeat steps 2-4 except that uncheck Application activated in step 3 this time.

Now you can open the Maps and Location will be enabled. You close the Maps and Location will be disabled. You can do more with it if you certainly want to disable Location (say 10 minutes) after minimizing the Maps.

Honestly, I'll prefer Tasker because I need fewer steps and I know it doesn't hog my battery. Check it out if AutomateIt eats the battery quite a lot.

  • 1
    I'll look in to this, but I don't need a battery hog, I'm running 4.4.2 which hogs enough battery as it is! Thank you though! – Kaizerwolf Jun 8 '15 at 15:38
  • You must have the last word here, yeah? :) +1 for a free alternative. As for the "battery hog": Maybe we'll get a third answer showing how it works with Llama … :D – Izzy Jun 8 '15 at 15:46
  • @Izzy I tried this Automate app but it seems to need superuser access to enable Location providers, which is bit silly IMO, to perform such a simple job for a normal user with SU access. – Firelord Jun 8 '15 at 16:22
  • @Firelord Downgrade below Android 4.2 if you need that done without root. That's what they call "security", you know :( I watch that game since Android 2.1: each new version takes away a little control from the user. One of the reasons I root any new device almost prior to unboxing it. – Izzy Jun 8 '15 at 16:25
2

As said, most automation apps can perform this task, Automate is another free alternative. Here's some user-made automations for toggling the GPS when viewing Google Maps:

http://llamalab.com/automate/community/?q=gps+maps

A rooted device is required, but it may be possible to workaround using UI automation.

  • I was trying this app and can manually execute the action. But I can't figure how it will automate itself. Could you please mention the steps involved in detail? Thank! and you'll have my +1 then as a goodwill gesture. :) – Firelord Jun 8 '15 at 18:55
  • And yeah, unlike other apps, it needs root access. Please mention it since the app wouldn't be useful to a normal regarding the current goal. – Firelord Jun 8 '15 at 18:57
  • 1
    @Firelord Yes, using the Android API for toggling GPS will require root, unless you automate UI interactions. The question didn't mention a non-root requirement. Look at community made flows, see link, there's plenty of examples that toggle the GPS. – ballzak Jun 8 '15 at 21:40
1

MacroDroid's free version can do it.

Edit: This answer is successfully tested on Android 4.2.1, without giving root access to MacroDroid. However, on Android 4.4.2, COS12 (Android 5.0.2) and CM12.1 (Android 5.1.1, build: YOG7DAO1K6), MacroDroid failed to complete the job without root access. This fact came to my notice through this comment by jonatr.

  1. When creating a macro choose the trigger Application Launched/Closed → Application Launch → select your app.
  2. Under Add Actions, tap GPS Enable/Disable → GPS On. It may say so but it doesn't need root access. See edit above.
  3. Create another macro but make it for Application Closed and set GPS Off as the action.

That's it. Launch that selected app and GPS would activate automatically, close the app and GPS would deactivate.

  • I tried the Macrodroid solution on my Oneplus one but it didn't work... but neither did the other solutions here :( – jonatr Feb 4 '16 at 14:07
  • I tested my solution on the same device but on COS12. Which OS are you using? Is it rooted? – Firelord Feb 4 '16 at 14:08
  • I'm using Cyanogen OS 12.1.1 . I built the macro but it didn't work... – jonatr Feb 4 '16 at 14:11
  • Interesting. I wonder what changed. And you're saying none of the solutions on this page worked for you? There must be some API change I need to find out. One more thing: is the device rooted? – Firelord Feb 4 '16 at 14:13
  • 1
    @jonatr: Root access is the only way here. I've edited both of my answers and verified the other answers as well. On my Android 4.4.2, 5.0.2 and 5.1.1, Tasker, Automate, AutomateIt and MacroDroid, all of them worked but only with root access, including on OnePlus One. // My apologies for wasting your time. I should've been clear in the answer from the beginning by mentioning the Android version I used for testing. // FYI: Tasker has a 7-day full trial version: tasker.dinglisch.net/download.html – Firelord Feb 4 '16 at 22:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.