Skip to content

Instantly share code, notes, and snippets.

View Tourenathan-G5organisation's full-sized avatar

Toure Nathan Tourenathan-G5organisation

View GitHub Profile
@Tourenathan-G5organisation
Tourenathan-G5organisation / .java
Created August 13, 2016 12:15
Check GPS activation on Android and prompt user to change GPS setting
final LocationManager manager = (LocationManager) getSystemService( Context.LOCATION_SERVICE );
if ( !manager.isProviderEnabled( LocationManager.GPS_PROVIDER ) ) {
buildAlertMessageNoGps();
}
private void buildAlertMessageNoGps() {
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Your GPS seems to be disabled, do you want to enable it?")
.setCancelable(false)