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.
There are several versioned components that affect the compilation process and the runtime behavior of our apps. The purpose of this tutorial is to explain the differences between them and help you choose which version to use. Each Android version is mapped to an api level. You can see this...
www.b4x.com
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.
I don't remember if it already exists but just as there is your thread, Erel, about common mistakes ("Code smells"), it would be useful to open another one like "Best practice with B4X".