Alex Rivera | Logout

Detecting GPS on/off switch in Android phones

Asked 2011-06-16T07:07:56.907
40

I would like to detect when the user changes the GPS settings on or off for an Android phone. Meaning when user switches GPS sattelite on/off or detection via access points etc.

Edit
Report

1 Answer

4

Try this,

try {
        locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);

        if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {

            Log.i("About GPS", "GPS is Enabled in your devide");
        } else {
            //showAlert
        }
answered 2011-06-16T07:15:30.007

Your Answer