Skip to content

Instantly share code, notes, and snippets.

@tobiasstraub
Created November 22, 2014 14:07
Show Gist options
  • Save tobiasstraub/7afaec14911df412bd8f to your computer and use it in GitHub Desktop.
Save tobiasstraub/7afaec14911df412bd8f to your computer and use it in GitHub Desktop.
Android: Check for GPS Provider is enabled, when not start Setting Activity to activate GPS
if (!((LocationManager) getSystemService(LOCATION_SERVICE)).isProviderEnabled(LocationManager.GPS_PROVIDER)) {
Toast.makeText(getApplicationContext(), R.string.activate_gps, Toast.LENGTH_LONG).show();
startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment