Search code examples
androidpermissionscamera

How to set camera permission on android?


I am trying to use the camera and for some reason that I cannot yet find, the camera stop working days ago

I have the maniset permissions and now when I try to take a picture it says

"java.io.ioexception permission denied"

This is the manifest

   <uses-permission android:name="android.permission.CAMERA" />

and this is how I take the picture

                        try {
                            mPhotoFile = Tools.createImageFile();
                            new CameraService().takePicture(CameraService.REQUEST_IMAGE_CAPTURE, contextActivity, mPhotoFile);
                        } catch (IOException ex) {
                            Log.e(TAG, "btnTakePictureSale error "+ex);
                            ex.printStackTrace();
                        }

Any help or suggestion on what to look for woudl be great. Again, it was working fine last week

I use the app over serveral versions of android and fine the same issue


Solution

  • try putting

    android:requestLegacyExternalStorage="true"
    

    on your manifest inside the application tag. maybe the camera permission is ok but the external write is not