Android Question Failed to find configured root that contains

vecino

Well-Known Member
Licensed User
Longtime User
Hi, I have a shared directory:
B4X:
cDirShared = rp.GetSafeDirDefaultExternal("shared")
I try to send an email with a zip attached:
B4X:
Message.Attachments.Add( CreateFileProviderUri(cDirShared,cFileZip) )
But I always get the error in this Sub:
B4X:
Sub CreateFileProviderUri (Dir As String, FileName As String) As Object
   Dim FileProvider As JavaObject
   Dim context As JavaObject
   context.InitializeContext
   FileProvider.InitializeStatic("android.support.v4.content.FileProvider")
   Dim f As JavaObject
   f.InitializeNewInstance("java.io.File", Array(Dir, FileName))
   Return FileProvider.RunMethod("getUriForFile", Array(context, Application.PackageName & ".provider",f))
End Sub
The error:
java.lang.IllegalArgumentException: Failed to find configured root that contains /storage/sdcard0/Android/data/conkex.preventa/files/shared/20181125011604presales.ZIP
Why?
Thank you.
 

vecino

Well-Known Member
Licensed User
Longtime User
Thanks, it worked fine.
So, basically, it looks like it's because the directory should be "local", not "external". Is that so?
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
I just saw it, it really has a level that I still can not reach to understand everything.
But someday I will understand
Thank you.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…