Share My Creation Open a text file with any extension

The application allows you to read such a file by clicking on its name in the phone's file manager.
Different managers return URIs according to their methods.
The managers I have give the following results:
B4X:
content://com.alphainventor.filemanager.fileprovider/root/storage/emulated/0/Download/my.ged
content://com.cxinventor.file.explorer.fileprovider/root/storage/emulated/0/Download/my.ged
content://com.android.externalstorage.documents/document/primary%3ADownload%2Fmy.ged
content://com.amaze.filemanager/storage_root/storage/emulated/0/Download/my.ged
To extract the values of the folder and file names, you need to normalize the URI:
B4X:
        Dim folder,filename As String
        Dim n As Int
        uri=Regex.Replace("%20", uri, " ")
        uri=Regex.Replace("%3A", uri, "/")
        uri=Regex.Replace("%2F", uri, "/")
        n=uri.LastIndexOf("/")
        filename=uri.SubString(n+1)
        uri=uri.SubString2(0,n)
        n=uri.LastIndexOf("/")
        folder=uri.SubString(n+1)
After that, do whatever you need with the data you receive.
There is one unsolved problem left. In order to use the app again, you need to not only close it, but turn it off completely.
An example of the app is attached.
 

Attachments

  • test_ged.zip
    5.2 KB · Views: 15

Sergey_New

Well-Known Member
Licensed User
Longtime User
For URI
B4X:
content://com.android.externalstorage.documents/document/primary%3ADownload%2Fmy.ged
it is required
B4X:
 uri=Regex.Replace("%3A", uri, "/")
 uri=Regex.Replace("%2F", uri, "/")
 

Sergey_New

Well-Known Member
Licensed User
Longtime User
Solved the problem with the complete shutdown of the application.
Sample application is attached.
 

Attachments

  • test_ged.zip
    5.2 KB · Views: 13
Top