I\'m trying to implement Marshmallow\'s permission support, but my code inside \"onRequestPermissionsResult\" is never called. The \"onCreate\" and \"onMapReady\" parts of the c
This line will never evaluate to true:
permissions[0] == android.Manifest.permission.ACCESS_FINE_LOCATION
Because you are comparing these two strings by reference.
You should use TextUtils.equals()
TextUtils.equals(permissions[0], android.Manifest.permission.ACCESS_FINE_LOCATION)
MY_LOCATION_REQUEST_CODE
should be a non-egative constant.
You should declare it as
private static final int MY_LOCATION_REQUEST_CODE = 1;
I have the same issue, the issue was only on API 23 (Android M).
And that because I was using the flag android:noHistory="true"
in the manifest when declaring the activity:
<activity android:name=".view.activity.SplashScreenActivity"
android:noHistory="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
That because when showing the permission dialog the activity will be finished by the system because of that flag.
Removing it, or setting it to false
fixes my issue.