I work with Camera2API and use for this the Google example which is on the gita
Mysticism is in this method which opens the camera
private void openCamera(int width, int height) { setUpCameraOutputs(width, height); configureTransform(width, height); CameraManager manager = (CameraManager) getSystemService(Context.CAMERA_SERVICE); try { if (!mCameraOpenCloseLock.tryAcquire(2500, TimeUnit.MILLISECONDS)) { throw new RuntimeException("Time out waiting to lock camera opening."); } if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) { return; } manager.openCamera(mCameraId, mStateCallback, mBackgroundHandler); } catch (CameraAccessException e) { e.printStackTrace(); } catch (InterruptedException e) { throw new RuntimeException("Interrupted while trying to lock camera opening.", e); } } Now I use Samsung S6 android 6.0
It is expected that the method manager.openCamera(mCameraId, mStateCallback, mBackgroundHandler); - will open the camera, but instead this code stops at
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) { return; } as far as I understand, it does not pass the permission check, I checked it in the manifest and there is the necessary permission
<uses-permission android:name="android.permission.CAMERA" /> What can this mean?
Then I tried to open the camera on the Meizu MX5 android 5.1 and everything opens and works correctly
Can the problem be in the versions of android?
What am I doing wrong? How can this be verified?
targetSDK=22and try, if it helps, it means that you incorrectly request the rights on the 6 android. - pavel