Hi all,
I'm improving my app for to save and open PDF file
With android:targetSdkVersion="14" was fine, but after increase targetSdkVersion to 26 not work
In the past I saved and read directly from DirRootExternal but now I cannot.
Now I'm using DirDefaultExternal but when I try to read the PDF file appear an error:
android.os.FileUriExposedException: file:///storage/emulated/0/Android/data/federico.completo.it/files/PP_2018-10-09-2307.pdf exposed beyond app through Intent.getData()
For to save I use:
For to read I use:
I cannot go ahead, someone can give me a new method ?
Please help
Thanks a lot in advance
I'm improving my app for to save and open PDF file
With android:targetSdkVersion="14" was fine, but after increase targetSdkVersion to 26 not work
In the past I saved and read directly from DirRootExternal but now I cannot.
Now I'm using DirDefaultExternal but when I try to read the PDF file appear an error:
android.os.FileUriExposedException: file:///storage/emulated/0/Android/data/federico.completo.it/files/PP_2018-10-09-2307.pdf exposed beyond app through Intent.getData()
For to save I use:
B4X:
PDFWriter1.ConverseDocument
Dim now As String
DateTime.DateFormat = "yyyy-MM-dd-HHmm"
now = DateTime.now
MyTime = DateTime.Date(now)
PDFWriter1.outputToFile(File.DirDefaultExternal, "PP_" & MyTime & ".pdf",PDFContent,"ISO-8859-1")
ToastMessageShow("Saved. ",False)
For to read I use:
B4X:
Sub show_click
Dim i As Intent
i.Initialize(i.ACTION_VIEW, "file://" & File.Combine(File.DirDefaultExternal,"PP_" & MyTime & ".pdf" ))
i.SetType("application/pdf")
i.WrapAsIntentChooser("Scegliere PDF Viewer")
StartActivity(i)
Return
End Sub
I cannot go ahead, someone can give me a new method ?
Please help
Thanks a lot in advance