The camera stops on some devices

1

I have created an app that opens camera and gallery, the detail is that it works on some devices, on another the app definitely stops.

private void openCamera() {
    File file = new File(Environment.getExternalStorageDirectory(), MEDIA_DIRECTORY);
    boolean isDirectoryCreated = file.exists();

    if(!isDirectoryCreated)
        isDirectoryCreated = file.mkdirs();

    if(isDirectoryCreated){
        Long timestamp = System.currentTimeMillis() / 1000;
        String imageName = timestamp.toString() + ".jpg";
        mPath = Environment.getExternalStorageDirectory() + File.separator + MEDIA_DIRECTORY
                + File.separator + imageName;

        File newFile = new File(mPath);
        Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(newFile));
        startActivityForResult(intent, PHOTO_CODE);
    }
}

the problem is with new generation devices

I've been seeing that on some devices I get this:

How can I delete it?

    
asked by DoubleM 23.01.2018 в 04:34
source

1 answer

-1

The screen overlay is a permission that appears on the screen when an application wishes to override other applications. Personally I could never remove this error in a programmatic way and in many forums I found that this depends on the operating system, so you do not have much control over this. For what work I recommend you enter applications and give that permission to your app manually and if that does not work you should look for the app you are trying to put on when you access the camera. Many times who generates this behavior are the facebook chat bubbles. In case you have them disabled and try again. For the rest, I have no other solution to this problem.

    
answered by 23.01.2018 в 15:02