I run into problem while using content uri and FileProvider on Android API 19 (Kitkat). Here\'s code that I use to open camera on device and record a video:
maybe you can try this one.
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT){
fileUri = Uri.fromFile(mTmpFile);
} else {
fileUri = FileProvider.getUriForFile(getContext(),
getContext().getPackageName()+".provider",mTmpFile);
}
Not every camera app will support content
Uri
values for EXTRA_OUTPUT
, though they should. But, there are thousands of camera apps, and some percentage will fail on such a Uri
. For example, until this summer, Google's own camera app did not support a content
Uri
for EXTRA_OUTPUT
for ACTION_VIDEO_CAPTURE
.
Either stop using ACTION_VIDEO_CAPTURE
or live with unreliable results.
If you wish to try continuing to use file
Uri
values, drop your targetSdkVersion
to 23 or lower, or disable the FileUriExposedException
by changing the StrictMode
configuration.