sakshi Agrawal
sakshi Agrawal

Reputation: 85

File read and write in Android 8.1 and above

I am trying to compress a video that is captured from the camera, but the compressed video cannot be saved in Android version 8.1. The same code is working fine for lower versions.

All the permissions that require READ and WRITE external storage are there.

 File videoFile = new File(pathToStoredVideo);
    String origin;
    origin = videoFile.getAbsolutePath();
    compressVideo(origin, origin);

I am trying to save a new file at the same location. This code is working fine with lower version but it is not working in Android version 8.1 and above.

Origin looks like this /storage/emulated/0/DCIM/Camera/VID_20190415_143927.mp4

Error in console- E/tmessages: /storage/emulated/0/DCIM/Camera/VID_20190408_173343395.mp4 (Permission denied) time = 18

Upvotes: 0

Views: 850

Answers (1)

Meet Patel
Meet Patel

Reputation: 81

For 8.0 and above only those permissions that are explicitly requested will be granted.

Did you add Read and Write request permission explicitly at runtime?

Unable to save image file in android oreo update. How to do it?

Upvotes: 2

Related Questions