You are looking for (updated to improve clarity):
@Override
@SuppressWarnings({"MissingPermission"})
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (LOCATION_REQUEST_CODE == requestCode) {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
lastLocation = LocationServices.FusedLocationApi.getLastLocation(googleApiClient);
}
}
EDITED:
The correct lint rule is MissingPermission, but there seems to be a bug that misplace it to some people.
So, please try @SuppressWarnings({“ResourceType”}), too.