I'm trying to ask the user to accept a camera permission request. I placed this in my onCreate()
method. It's saying it cannot resolve the symbol 'CAMERA'. What's wrong?
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (checkSelfPermission(Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA}, 1);
}
}
You need to import the correct Manifest
. You probably have something like this:
import <your_package_name>.Manifest;
Remove it and change with:
import android.Manifest;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With