I'm trying to request permissions to take photo with camera app and saving it to file system. I' m using
ActivityCompat.requestPermissions(this,new String[]{
Manifest.permission.CAMERA,
Manifest.permission.READ_EXTERNAL_STORAGE
}, PERMISSIONS_MULTIPLE_REQUEST);
But this only shows a dialog to ask user about external storage. If i try to access camera, i get an exception
java.lang.RuntimeException: Unable to start activity ComponentInfo{it.cosmopolitans.around/it.cosmopolitans.around.Boundary.ImageTakenActivity}: android.os.FileUriExposedException: file:///storage/emulated/0/Pictures/Hello%20Camera/IMG_20170709_194415.jpg exposed beyond app through ClipData.Item.getUri()
at this line
startActivityForResult(intent, CAMERA_CAPTURE_IMAGE_REQUEST_CODE);
Everything is fine if i run the app on a before-marshmellow device