Note that you need to use FileProvider on higher Android versions and especially higher tagetSDK
This works with targetsdk 28
B4X:
Dim FileName As String = "xx.pdf"
File.Copy(File.DirAssets, FileName, Starter.Provider.SharedFolder, FileName)
Dim in As Intent
in.Initialize(in.ACTION_VIEW, "")
Starter.Provider.SetFileUriAsIntentData(in, FileName)
'Type must be set after calling SetFileUriAsIntentData
in.SetComponent("android/com.android.internal.app.ResolverActivity")
in.SetType("application/pdf")
StartActivity(in)
Use SetComponent and try to fill in the packagename from the Adobe Acrobat app instead of "android/com.android.internal.app.ResolverActivity"
This requires the app to be installed. It does not work if exact this app is not installed.
Sorry, but it doesn't work. There are many apps again to choose one.
This example works:
B4X:
Dim ph As Phone
Dim pm As PackageManager
Dim in As Intent
in = pm.GetApplicationIntent("com.adobe.reader")
If in.IsInitialized Then
Msgbox("found","")
Dim FileName As String = "xx.pdf"
File.Copy(File.DirDefaultExternal & "/Examples", FileName, Starter.Provider.SharedFolder, FileName)
Starter.Provider.SetFileUriAsIntentData(in, FileName)
StartActivity(in)
End If
How can I close Acrobat Reader when the app is finished?