user7090887 user7090887 - 25 days ago 12
Android Question

How to check in realtime if Location services switched off by user in a tracking app

I am developing a tracking app using fused location api. I want to check pragmatically if user has turned off location services while app is running. I am thinking of running a parallel thread to check if GPS has been turned off by user in every 5 sec using method LocationManager.isProviderEnabled(). Is this the right approach or there is a better way to do it.

Sanju

Answer

Use broadcast receiver, when GPS settings will be changes, you will get automatically notify.

here is the link:

https://developer.android.com/training/monitoring-device-state/manifest-receivers.html

Comments