Android "onRequestPermissionsResult" not being called
<p>I'm trying to implement Marshmallow's permission support, but my code inside "onRequestPermissionsResult" is never called. The "onCreate" and "onMapReady" parts of the code work fine. Checking if the device has the permission and requesting the permission works fine.</p>

<p>I'm using an Nexus 5X emulator running Android Marshmallow 6.0, API 23.</p>

<p>I have tried to do what it's mentioned here -> <a href="https://stackoverflow.com/questions/32714787/android-m-permissions-onrequestpermissionsresult-not-being-called">Android M Permissions: onRequestPermissionsResult() not being called</a></p>

<p>But I cannot get it to work, it doesn't matter if I use "ActivityCompat.requestPermissions" or directly "requestPermissions", it nevers get called.</p>

<p>I also updated my appcompat and support libraries to v24.2.0</p>

<p>Any ideas?</p>

<p>This is my activity:</p>

<pre><code>public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {

private GoogleMap mMap;
UiSettings mapSettings;
int MY_LOCATION_REQUEST_CODE;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_maps);
    // Obtain the SupportMapFragment and get notified when the map is ready to be used.
    SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
            .findFragmentById(R.id.map);
    mapFragment.getMapAsync(this);

}


@Override
public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;

    //Check location permission for sdk &gt;= 23
    if (Build.VERSION.SDK_INT &gt;= 23) {

        if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION)
                == PackageManager.PERMISSION_GRANTED) {
            mMap.setMyLocationEnabled(true);
        } else {
            // Request permission.
            ActivityCompat.requestPermissions(MapsActivity.this, new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION},
                    MY_LOCATION_REQUEST_CODE);
        }
    }

}

@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
    if (requestCode == MY_LOCATION_REQUEST_CODE) {
        if (permissions.length == 1 &amp;&amp;
                permissions[0] == android.Manifest.permission.ACCESS_FINE_LOCATION &amp;&amp;
                grantResults[0] == PackageManager.PERMISSION_GRANTED) {
            mMap.setMyLocationEnabled(true);
        } else {
            // Permission was denied. Display an error message.
        }
    }
}
</code></pre>

<p>}</p>