I have an exception that happens only on Huawei devices in my app when using FileProvider.getUriForFile
:
Exception: java.lang.Illeg
Try to manually provide the uri
var fileUri:Uri
try{
fileUri = FileProvider.getUriForFile(
this,
"com.example.android.fileprovider",
it
)
} catch (e:Exception){
Log.w("fileProvider Exception","$e")
fileUri=Uri.parse("content://${authority}/${external-path name}/${file name}")
}
get authority from android:authorites in the provider tag inside AndroidManifest.xml
get external-path name from name in the external path tag inside file_paths.xml