Reputation: 813
I'm getting: android.os.FileUriExposedException.
When targeting Android N, file:// URIs are not allowed anymore. I know We should use content:// URIs instead. However, my app needs file for both image and video. Any ideas?
mMediaUri = Uri.fromFile(new File(AppHelper.getDirectoryPath(),AppHelper.getFileName() + ".jpeg"));
Intent iCamera = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
iCamera.putExtra(MediaStore.EXTRA_OUTPUT, mMediaUri);
startActivityForResult(iCamera, Constants.INTENT_CALL.CAPTURE_IMAGE);
and onActivityResult
case Constants.INTENT_CALL.CAPTURE_IMAGE:
String filePath=SiliCompressor.with(getActivity()).compress(mMediaUri.toString(), true);
Please add sample code...if Available.
Upvotes: 1
Views: 331
Reputation: 813
After some research finally got relevant answer to my question just set min target sdk version to 23.
Upvotes: 4