Android Question Open PDF file

Zak Petr

Member
Licensed User
Longtime User
Hi,

I need to open downloaded pdf file, which is saved in File.DirInternal .
I use this code:
[CODE lang="b4x" title="par of code"]
Dim ia As Intent

If File.Exists(File.DirInternal ,"downloaded.pdf") Then
ia.Initialize(ia.ACTION_VIEW, "content://" & File.Combine(File.DirInternal,"downloaded.pdf" ))
ia.SetType("application/pdf")
ia.WrapAsIntentChooser("Choose PDF Viewer")
StartActivity(ia)
End If
[/CODE]

Dialog for select reader starts properly.
If I select reader, reader starts properly as well.

But each reader tell me, that file is not accessible .

Android Version in Phone is 11 .

Manifest info: <uses-sdk android:minSdkVersion="17" android:targetSdkVersion="28" />


I tried:
- to use File.DirRootExternall or DirExternall - the same problem
- to use file:// instead of "content://" - the same problem

Many thanks for your answers.
 
You need to use fileProvider
 
Upvote 1
Back
Top