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)
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