Android Question [solved] Using GetFileUri from a class

udg

Expert
Licensed User
Longtime User
Hi all,

when updating code for my lib AppUpdating in order to have it work in Adroid 8, I copied the code for sub GetFileUri from FileProvider class to my own cl_appupdate.

In my class initialization there's the same code from original class Initialize; the sub was copied as is.
Manifest file for the code that should use my class is exactly as that showed on the mentioned thread.

Running my demo code for the lib, I see in the logs:
context = (main) b4a.example.appupdate2.main@8340452
getUriForFile = content://b4a.example.appupdate2.provider/name/tmp.apk

Looks ok if we should consider "name" as a way to hide the real subdir name ("shared" in ShareFolder).

Now, a fellow member of this great Forum tells me that on his device he got:
context = (main) com.BizMobl.main@8e6899
java.lang.IllegalArgumentException: Failed to find configured root that contains /data/data/com.BizMobl/files/shared/tmp.apk
where he expected /data/com.... (one /data only, not two).

So, in his case, the getUriForFile seems to fail and it refers to a diffent scheme to indicate the subdir containing the temp file (tmp.apk).

What could be the problem?

TIA
 
Last edited:

udg

Expert
Licensed User
Longtime User
The problem was that our fellow members' Manifest file was neither complete nor entirely correct.

Sorry if my post caused anybody to waste time on the subject.
 
Last edited:
Upvote 0

Alessandro71

Well-Known Member
Licensed User
Longtime User
found
since my code went from a previous project, the following manifest config was "external-files-path" rather than "files-path"
not so evident at first sight

B4X:
CreateResource(xml, provider_paths,
   <files-path name="name" path="shared" />
)
 
Upvote 0