Android - Backward Compatibility (Context Compat Error)

Hello, I’ve been trying to perform a simple permission check on Android.

if (ContextCompat.checkSelfPermission(permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
                        alertboxGranted();
                }

I’ve been trying support 4x Android (Basically <23 API)

(Also, FYI, I have imported the required components in the Manifest and at the start of the program)

However, when I add the above ContextCompat, it comes up with error that the checkSelfPermission cannot be applied to java.lang.Strings

But isn’t ContextCompat basically there to support the checkSelfPermission? I am not sure why it’s coming up that error. Can anyone suggest why that error would come up?

Thanks!

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.