I am trying to transfer a program that I wrote in the DroidScript IDE, that uses JavaScript, to B4A as ultimately B4A should give me more capability although at the cost of more complexity.
In B4A I can successfully write a kml file to the Download folder 'File.DirRootExternal & "/Download/' and when I click on it in Ghost Commander I get a choice of the installed apps that can open it. I want the user to be able to select from Google Earth or the AlpineQuest mapping app and both are shown from Ghost Commander and both can open the file when I select it.
In DroidScript, which is fully updated to deal withe ramifications of SAF and API 26, I can get the same choice of apps to pop up and successfully select by invoking
I have tried totally unsuccessfully to replicate this in B4A using
I never really got the hang of intents and this just gives me a FileUriExposedException error.
I put this together from Erel's FileProvider class example although I don't understand the manifest entry
CreateResource(xml, provider_paths, <files-path name="name" path="shared" />)
which shows the popup I expected but when I select Google Earth it opens then closes immediately and when I select AlpineQuest it gives me the error
SecurityException(Permission Denial: opening provider android.support.v4.content.FileProvider from ProcessRecord{...}(pid=32279, uid=10099) that is not exported from UID 10152)[/code]
Yet tapping on that same file in Ghost Commander will open it successfully in both Google Earth and AlpineQuest. Any ideas?
In B4A I can successfully write a kml file to the Download folder 'File.DirRootExternal & "/Download/' and when I click on it in Ghost Commander I get a choice of the installed apps that can open it. I want the user to be able to select from Google Earth or the AlpineQuest mapping app and both are shown from Ghost Commander and both can open the file when I select it.
In DroidScript, which is fully updated to deal withe ramifications of SAF and API 26, I can get the same choice of apps to pop up and successfully select by invoking
B4X:
app.OpenFile(filepath,"application/vnd.google-earth.kml+xml", "Choose a progam");
I have tried totally unsuccessfully to replicate this in B4A using
B4X:
Dim intent1 As Intent
intent1.Initialize(intent1.ACTION_VIEW, "file://" & File.Combine(path,KMLname & ".kml"))
intent1.SetType("application/vnd.google-earth.kml+xml")
StartActivity(intent1)
I put this together from Erel's FileProvider class example although I don't understand the manifest entry
CreateResource(xml, provider_paths, <files-path name="name" path="shared" />)
B4X:
Dim path As String = File.DirRootExternal & "/Download/"
Dim intent1 As Intent
intent1.Initialize(intent1.ACTION_VIEW, Starter.Provider.GetFileUri(File.Combine(path,KMLname & ".kml")))
intent1.SetType("application/vnd.google-earth.kml+xml")
StartActivity(intent1)
SecurityException(Permission Denial: opening provider android.support.v4.content.FileProvider from ProcessRecord{...}(pid=32279, uid=10099) that is not exported from UID 10152)[/code]
Yet tapping on that same file in Ghost Commander will open it successfully in both Google Earth and AlpineQuest. Any ideas?
Last edited: