title: How to know if Location is enabled from settings for Android Application programmatically
body: <p><strong>UPDATE 2</strong></p>
  
  <p>I understand that SelfCheckPermission may help or the real answer but the problem is I can't find the right keyword. </p>
  
  <p>If it is for camera, I will just need this code</p>
  
  <pre><code>if(CheckSelfPermission(Manifest.Permission.Camera)
                  == Permission.Granted)
  </code></pre>
  
  <p>If it is other stuff like read contacts, I can use this code.</p>
  
  <pre><code>if(CheckSelfPermission(Manifest.Permission.ReadContacts)
                  == Permission.Granted)
  </code></pre>
  
  <p>But I can't ask the Location if enabled in Application Settings using AccessCoarseLocation and AccessFineLocation since they are still both true even I disabled the Location on my App's Application Settings. Maybe I just need a right keyword for this and that's where I need your help.</p>
  
  <hr>
  
  <p><strong>UPDATE 1</strong></p>
  
  <p>Location Service is not what I meant here. Location Service, Coarse and Fine Location Permission can be enable or disable without relation to the Application Permission for Location on Application Settings. What I need is to check application settings from settings -> apps/applition -> your app -> location if location is disabled or not. Example app is this Waze with location disabled </p>
  
  <p><a href="https://i.stack.imgur.com/t9i7z.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/t9i7z.jpg" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/IqhwH.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IqhwH.jpg" alt="enter image description here"></a></p>
  
  <hr>
  
  <p><strong>ORIGINAL POST</strong></p>
  
  <p>Everything I searched is to selfcheck the permission for coarse and fine location but it doesn't solve my issue since it is always granted even if the location from settings of app is disabled. I need to detect if the app settings is allowed for location or not. </p>
  
  <p>What I have now is to redirect to app settings to allow needed permission. TIA.</p>
  
  <p><a href="https://i.stack.imgur.com/hPAuA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hPAuA.png" alt="enter image description here"></a>
  CTTO - Pic from Google</p>