The following code can be used to start Location setting:
Intent intent = new Intent(Settings.ACTION_SECURITY_SETTINGS);
startActivity(intent);
This example will start Location setting if GPS is curently disabled:
Intent intent = new Intent(Settings.ACTION_SECURITY_SETTINGS);
startActivity(intent);
This example will start Location setting if GPS is curently disabled:
String GpsProvider = Settings.Secure.getString(getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED); if(GpsProvider.equals("")){ //GPS Disabled gpsState.setText("GPS Disable"); Intent intent = new Intent(Settings.ACTION_SECURITY_SETTINGS); startActivity(intent); }else{ //GPS Enabled gpsState.setText("GPS Enable"); }
No comments:
Post a Comment