I attempted to download a pdf via httpJob by file copy http input stream to "OutStream". "FindUserDownloadsFolder" is File.DirInternal
OutStream = File.OpenOutput(FindUserDownloadsFolder, customPdfFilenameToSave, False)
File.Copy2(Job.GetInputStream,OutStream)
then I attempted to open it with OpenPDF
OpenPDF("file://" & File.Combine(FindUserDownloadsFolder, customPdfFilenameToSave))
Sub OpenPDF(FileName As String)
Dim i As Intent 'Requires a reference to the Phone library
i.Initialize(i.ACTION_VIEW, FileName)
i.SetType("application/pdf")
i.WrapAsIntentChooser("Choose PDF Viewer")
StartActivity(i)
End Sub
Error I got: android.os.FileUriExposedException: file:///data/user/0/com.abcd.doc.updater/files/abcd.pdf exposed beyond app through Intent.getData()
Where "com.abcd.doc.updater" is my Build Configurations, "Package Name". And I checked via internal storage of the phone, such path [internal storage]/android/data/com.abcd.doc.updater/ or any subdirectories of that do not exist.
What could be the issue here? Can someone shed some light? Is File.DirInternal the best place to store downloaded files? e.g. pdfs? Or a different place like File.DirDefaultExternal? Does access permission come into play for any place to store the downloaded file?