A sample project explaining Scoped storage with different operations performed on file as well as Image.
Note: You have add if-else logics based on API levels as MediaStore APIs are available in latest versions only. I am providing here the sample for different operations with latest changes to demonstrate the usage as older one code you already have. You can use Opting Out to opt out of storage till Android 10.