Android Question Open PDF problen

mrossen

Active Member
Licensed User
Longtime User
Hi,

I have a old app I have changed the way I detect the "File.DirDefaultExternal"

I got some error so i changed to:

B4X:
Sub Process_Globals

    Public rp As RuntimePermissions
    Public SourceFolder As String

End Sub

Sub Service_Create
    
    SourceFolder = rp.GetSafeDirDefaultExternal("")
    
End Sub

This seems to work also on my new devices.

But now I cannot open PDF files anymore. My app download and put the pdf in default dir. that works without any problems. But when I try to open the file acrobat reader says the file does not exist.

It is in the dir and this code : "If File.Exists(Starter.SourceFolder, sPath)" also is true.

Any one see what the problem can be?

B4X:
If File.Exists(Starter.SourceFolder, sPath) Then
        Dim Intent1 As Intent
        
            Log(File.Combine(Starter.SourceFolder, sPath))
            
            Intent1.Initialize(Intent1.ACTION_VIEW, File.Combine(Starter.SourceFolder, sPath))
            Intent1.SetComponent("android/com.android.internal.app.ResolverActivity")
            Intent1.SetType("application/pdf")
            
            StartActivity(Intent1)
            Return
                    
    End If
 
Top