My application needs GPS, so when a specific operation is performed I check if the GPS is enabled as following (and as suggested by Marcus in this other question):
if (!locationManager.isProviderEnabled( LocationManager.GPS_PROVIDER )) {
buildAlertMessageNoGps();
}
rootView = inflater.inflate(R.layout.fragment_alert, container, false);
[...]
The problem is that the user, from the location settings, could not enable the GPS (e.g., by clicking on the "back" button and going back to the application). In this particular case, the fragment injects the layout for the corresponding process, but the GPS is still disabled. How to solve that?