Android - Check if Location is Enabled
< uses-permission android :name= "android.permission.ACCESS_COARSE_LOCATION" /> public boolean checkLocation() { LocationManager lm = (LocationManager)getSystemService(Context. LOCATION_SERVICE ); boolean gps_enabled = false ; try { gps_enabled = lm.isProviderEnabled(LocationManager. GPS_PROVIDER ); } catch (Exception ex) {} if (gps_enabled) { return true ; } else { return false ; } }