Android Question Can't figure out how to share files from my app

Creaky

Member
Licensed User
Longtime User
Hi guys,

I've been using MESShareLibrary to share a file generated by my app with other apps like Gmail.

B4X:
Sub shareFile(strFileName As String)
    Dim share As MESShareLibrary
    share.sharebinary(File.DirRootExternal & "/StarLog/" & strFileName, "text/plain", "Startlog export file","Startlog export file")
End Sub

Unfortunately this doesn't seem to work anymore. Searching the forums I found out you need to use FileProvider these days.
But the example Erel has provided doesn't work for me because it can't find the B4XPagesManager libary.

B4X:
Sub Activity_Create(FirstTime As Boolean)
    Dim pm As B4XPagesManager
    pm.Initialize(Activity)
End Sub

It would be a great help if someone can give me, or point me towards, a working example.
 

DonManfred

Expert
Licensed User
Longtime User
share.sharebinary(File.DirRootExternal
It will not work!

You need to use FileProvider to share files.

You are trying to run code from a B4XPages-Project in a normal App i guess.
You can use the Class in normal apps too.

Tip: Forget about all the restrictions with the ActivityLifetimecycle and switch to B4XPages.
 
Upvote 0

Creaky

Member
Licensed User
Longtime User
Thanks for replying! But unfortunately you haven't provided me with a working example, so I still have no idea how to fix the issue...
 
Upvote 0
Top