Android Example Share Text File Between 2 Apps

This is just another example based on the ManageExternalStorage class provided by @agraham.
It is a response to this question.

B4ARepositoryWriter - writes a text file to an "external" directory (you can view using File Explorer).
B4ARepositoryReader - reads the text file in this directory if it exist.

I guess if we are able to read a text file then it should be possible to read keyvaluestore or sqlite files.

Note: I have modified slightly the class by modify the package name by reading Application.PackageName
Credit to Andrew Graham

1717231841785.png
 

Attachments

  • B4ARepositoryWriter.zip
    11.3 KB · Views: 55
  • B4ARepositoryReader.zip
    11.4 KB · Views: 52

toby

Well-Known Member
Licensed User
Longtime User
Since your apps won't be published to the Play store,you could keep it simple by setting sdk level to 28 and storing files at File.DirRootExternal location, directly accessible to all 3 apps.
 

aeric

Expert
Licensed User
Longtime User
Since your apps won't be published to the Play store,you could keep it simple by setting sdk level to 28 and storing files at File.DirRootExternal location, directly accessible to all 3 apps.
I was unable to get it work under Android 14 even though I set the targetSDK to 23.
 

aeric

Expert
Licensed User
Longtime User
I was unable to get it work under Android 14 even though I set the targetSDK to 23.
I think I missed the RuntimePermissions. I can't remember why it was an issue last time.

B4X:
Dim rp As RuntimePermissions
rp.CheckAndRequest(rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean)
Log($"${Permission} = ${Result}"$)
 

aeric

Expert
Licensed User
Longtime User

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
exactly what i was searching for long time

one question: will it be accepted by google play store?
 
Top