title: How to read the state of current permission status?
body: <p>In my app, I need GPS to locate the user. I wish my app provide following kinds of result. </p>
  
  <pre><code>1.The current location.(Success)
  2.Failed to get current location because of device error or something else. (Failed)
  3.The user refused the permission. (Permission denied)
  </code></pre>
  
  <p>I use LocationManager to do the job. </p>
  
  <pre><code>locationManager = (LocationManager)mActivity.getSystemService(Context.LOCATION_SERVICE);
  Location location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
  </code></pre>
  
  <p>If the permission is denied, the location will be null. </p>
  
  <p>But I don't know what the location will be if the function failed. And I 'm not sure whether that location is null and user refuse to open GPS are equal.</p>
  
  <p>With the following code, I might know whether the permission is added in the AndroidManifest.xml. But I can't get the information I need.</p>
  
  <pre><code>boolean getLocationOn = (PackageManager.PERMISSION_GRANTED ==   
             pm.checkPermission("android.permission.ACCESS_FINE_LOCATION", "my_package"));
  </code></pre>