I\'ve read different posts that there is no way to wait for the user to take an action when an AlertDialog
is shown because it blocks the UI.
However,
I done that by using simple function but without displaying an alert box i redirected usercontrol to setting page
Here is the function i used
public void isGPSEnable(){
LocationManager service = (LocationManager) getSystemService(LOCATION_SERVICE);
boolean enabled = service
.isProviderEnabled(LocationManager.GPS_PROVIDER);
if (!enabled) {
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(intent);
}
}