Skip to content

Instantly share code, notes, and snippets.

@Viyu
Created March 7, 2014 06:27
Show Gist options
  • Save Viyu/9406327 to your computer and use it in GitHub Desktop.
Save Viyu/9406327 to your computer and use it in GitHub Desktop.
public boolean isGPSIsOn() {
LocationManager locationManager = (LocationManager) mContext
.getSystemService(Context.LOCATION_SERVICE);
return locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
}
public void openGPSSettingPage() {
Intent intent = new Intent();
intent.setAction(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
try {
context.startActivity(intent);
} catch (ActivityNotFoundException ex) {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment