here is my code and it works perfectly fine.
if (ActivityCompat.checkSelfPermission(activity, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManag
You can suppress this error in both the editor and in lint reports by annotating your method with @SuppressWarnings("MissingPermission")
, or you can suppress the error for just a single statement by putting //noinspection MissingPermission
above that line.
For example:
@SuppressWarnings("MissingPermission")
public boolean hasMapLocationPermissions(Activity activity) {
// your checking logic
}
Or:
if (Utils.hasMapLocationPermissions(getActivity())) {
//noinspection MissingPermission
mMap.setMyLocationEnabled(true);
}