Android Question agraham : manage external stotage - indent.ACTION_X

a n g l o

Active Member
Licensed User
Longtime User
a.graham, thanks a lot for that class.

about 8 years ago i wrote for my own personal use a file manager which was (still is) suitable exactly to my needs and madness.
it was (and still is) working without any problems or crashes everyday for 8 years on several devices.

now with android 14 and higher SDKs versions, i had to dive back into b4a and especially this app again....and it's NOT like riding bicycle.....

as expected, i've first found EREL tutorial of fileProvider and started implementing and made some progress (althought i hate the preseption behind it).

then i bumped into your post. a combination of just the right preseption, with a person that have the ability to carry it out.

so, i put aside the fileProvider and tried yours.

the good things are that installation on android 14 was smooth, permission granted, and all traditional files and folders actions work as before.

the problems are whenever the good and old code comes to indent.ACTION_VIEW/SEND etc. at those points it seems that there is no escape from the fileProvider monster.

Q : were you aware of that ? - or alternatively - can YOU make it work without fileProvider ?

Thanks a lot
 

agraham

Expert
Licensed User
Longtime User
the good and old code comes to indent.ACTION_VIEW/SEND
Sorry but I don't understand the problem but that special permission only allows access to the entire file store. Once you have access to the file you can only do what you would do otherwise.
 
Upvote 0

a n g l o

Active Member
Licensed User
Longtime User
hi. thanks.

here is a little test base on your class. (built folder not included (file too big to upload ??!!??))

if you want to be sure that the code is correct - use a device below android 14 and set the target sdk to 21 - this way all is running ok.
on any other case (old device with target sdk 33, and on android 14 device) - the sub actionView raise the error :

android.os.FileUriExposedException: file:/storage/emulated/0/111/111.jpg exposed beyond app through Intent.getData()
 

Attachments

  • 111.rar
    225 KB · Views: 44
Upvote 0

agraham

Expert
Licensed User
Longtime User
Nothing to do with my class. As I said above "Once you have access to the file you can only do what you would do otherwise." Google keeps tightening security in newer Android releases. Looks like you hit some kind of permission or other security problem in the later SDK. Probably this

If your targetSdkVersion >= 24, then we have to use FileProvider class to give access to the particular file or folder to make them accessible for other apps.
 
Upvote 0

a n g l o

Active Member
Licensed User
Longtime User
yeah, as i assumed and wrote at first - no escape from fileProvider....
thank you anyway for trying...
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…