Request camera permission on Android SDK 23

I am trying to ask a user to accept a camera permission request. I put this in my onCreate() method. He says that he cannot resolve the CAMERA symbol. 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); } } 
+5
source share
1 answer

You need to import the correct Manifest . You probably have something like this:

 import <your_package_name>.Manifest; 

Delete it and change with:

 import android.Manifest; 
+6
source

Source: https://habr.com/ru/post/1243199/


All Articles