Is there a way to disable GPS if not in use by any app – either provided by Android itself or, if that's not possible, by use of a third-party app?
2 Answers
GPS is automatically turned-off when not in use by apps. That said, apps can use GPS even if they work in background. So, I guess that your concern should be checking the apps that use GPS in the background, rather than turning it off completely.
As Aleks pointed out, GPS only "drains battery" when accessed – its battery use in standby is negligible (see my answer here for some statistics). You can see whenever some app is accessing it, as then the cross-hair GPS icon appears in the notification bar.
However, some (badly coded) apps might be "hammering" GPS for location details. If you encounter such an app (but cannot live without that particular one), there are some automation tools which can take care for that (see e.g. our tasker tag-wiki) – and e.g. turn GPS of as soon as that "waster" starts, or after a delay of say 1 min to allow it for one fix and not more.
/help/on-topic
page of an SE site before posting :)