title: Check if 'Access to my location' is enabled - Android
body: <p>I have an android app that uses location. But I noticed that if users disable the 'Access to my location' in Settings > Location access, nothing works anymore. How can I check that it's enabled?
  In case it's disabled, how to open those settings from my app?</p>
  
  <p>Thanks</p>
  
  <p><strong>SOLVED :</strong></p>
  
  <pre><code>String locationProviders = Settings.Secure.getString(getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED);
  if (locationProviders == null || locationProviders.equals("")) {
      ...
      startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS));
  }
  </code></pre>