Created
July 15, 2016 23:23
-
-
Save JosiasSena/38670b172b4f4e68ac86a856d785b085 to your computer and use it in GitHub Desktop.
check if GPS is enabled
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Returns the current enabled/disabled status of the GPS provider. | |
* <p/> | |
* If the user has enabled GPS in the Settings menu, true | |
* is returned otherwise false is returned | |
*/ | |
public static boolean isGpsEnabled(final Context context) { | |
final LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); | |
return locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment