0

I've successfully developed a tracking app which logs the location of the mobile to a web server. But I have to keep active the location & data services all the time. Is there a way to enable and disable these services automatically, only when it requires.

Target version: Android 4.4.4 (KitKat)

Kevin
  • 153
  • 1
  • 3
  • 12
  • 1
    refer this Question https://stackoverflow.com/questions/33251373/turn-on-location-services-without-navigating-to-settings-page –  Oct 17 '17 at 11:01
  • 1
    That @OmDave is saying is the same as me when I refer to control the location inside the app with Google Play Services – webo80 Oct 17 '17 at 11:03

1 Answers1

0

Regarding the data, there is nothing you can do. You can't enable/disable data connectivity (cellullar) programatically.

Regarding the location, you can't enable on demand, but you can open the settings location tab: startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS));

Or you can prompt to enable (not to disable) the location settings, just from inside of the app, showing a dialog with the help of Google Play Services. The docs are here

webo80
  • 3,365
  • 5
  • 35
  • 52