title: Caused by: java.lang.SecurityException: "gps" location provider requires ACCESS_FINE_LOCATION permission
body: <p><strong>I already set permission. Why do I still get this error?</strong></p>
  
  <blockquote>
    <p>Caused by: java.lang.SecurityException: "gps" location provider requires ACCESS_FINE_LOCATION permission.</p>
  </blockquote>
  
  <p>My manifest contents:</p>
  
  <pre><code>    &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  </code></pre>
  
  <p>My Activity code:</p>
  
  <pre><code>    public class LocationActivity extends Activity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_location);
          if (savedInstanceState == null) {
              getFragmentManager().beginTransaction()
                      .add(R.id.container, new PlaceholderFragment())
                      .commit();
          }
      }
  
  
  
  
      /**
       * A placeholder fragment containing a simple view.
       */
      public static class PlaceholderFragment extends Fragment {
  
          private LocationManager mLocationManager;
  
          public PlaceholderFragment() {
          }
  
          private final LocationListener locationListener = new LocationListener() {
              @Override
              public void onLocationChanged(Location location) {
              txtLat = (TextView) findViewById(R.id.textview1);
  txtLat.setText("Latitude:" + location.getLatitude() + ", Longitude:" + location.getLongitude());
  
              }
  
              @Override
              public void onStatusChanged(String provider, int status, Bundle extras) {
  
              }
  
              @Override
              public void onProviderEnabled(String provider) {
  
              }
  
              @Override
              public void onProviderDisabled(String provider) {
  
              }
          };
  
          @Override
          public View onCreateView(LayoutInflater inflater, ViewGroup container,
                  Bundle savedInstanceState) {
              View rootView = inflater.inflate(R.layout.fragment_location, container, false);
  
              mLocationManager = (LocationManager) getActivity().getSystemService(LOCATION_SERVICE);
  
              mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0,0,            locationListener);
  
              return rootView;
          }
      }
  }
  </code></pre>