Sergey_New Well-Known Member Licensed User Longtime User Apr 28, 2023 #1 Please tell me how to find out if there is a PDF viewer on the user's device?
Solution JohnC Apr 28, 2023 Try this code (from post #3 in the first link I posted) and see if it lists any apps, if it does, then it should be able to open a PDF file: B4X: Copy Dim pm As PackageManager Dim Intent1 As Intent Intent1.Initialize(Intent1.ACTION_VIEW, "file://") Intent1.SetType("application/pdf") For Each cn As String In pm.queryIntentActivities (Intent1) Log(cn) Next
Try this code (from post #3 in the first link I posted) and see if it lists any apps, if it does, then it should be able to open a PDF file: B4X: Copy Dim pm As PackageManager Dim Intent1 As Intent Intent1.Initialize(Intent1.ACTION_VIEW, "file://") Intent1.SetType("application/pdf") For Each cn As String In pm.queryIntentActivities (Intent1) Log(cn) Next
JohnC Expert Licensed User Longtime User Apr 28, 2023 #2 This posts might help you... Check if pdf document can be opened I have this piece of code ' open Pdf Document Try Dim in As Intent in.Initialize(in.ACTION_VIEW, "") Starter.Provider.SetFileUriAsIntentData(in, PdfFile) in.SetType("application/pdf")... www.b4x.com Last edited: Apr 28, 2023 Upvote 0
This posts might help you... Check if pdf document can be opened I have this piece of code ' open Pdf Document Try Dim in As Intent in.Initialize(in.ACTION_VIEW, "") Starter.Provider.SetFileUriAsIntentData(in, PdfFile) in.SetType("application/pdf")... www.b4x.com
Sergey_New Well-Known Member Licensed User Longtime User Apr 28, 2023 #3 Thanks, checked: B4X: Copy Dim pm As PackageManager 'phone library Dim in1 As Intent in1.Initialize("android.nfc.action.TECH_DISCOVERED", "") For Each s As String In pm.QueryIntentActivities(in1) Log(s) Next Result: B4X: Copy pm.QueryIntentActivities(in1).size=0 Upvote 0
Thanks, checked: B4X: Copy Dim pm As PackageManager 'phone library Dim in1 As Intent in1.Initialize("android.nfc.action.TECH_DISCOVERED", "") For Each s As String In pm.QueryIntentActivities(in1) Log(s) Next Result: B4X: Copy pm.QueryIntentActivities(in1).size=0
JohnC Expert Licensed User Longtime User Apr 28, 2023 #4 Try this code (from post #3 in the first link I posted) and see if it lists any apps, if it does, then it should be able to open a PDF file: B4X: Copy Dim pm As PackageManager Dim Intent1 As Intent Intent1.Initialize(Intent1.ACTION_VIEW, "file://") Intent1.SetType("application/pdf") For Each cn As String In pm.queryIntentActivities (Intent1) Log(cn) Next Upvote 0 Solution
Try this code (from post #3 in the first link I posted) and see if it lists any apps, if it does, then it should be able to open a PDF file: B4X: Copy Dim pm As PackageManager Dim Intent1 As Intent Intent1.Initialize(Intent1.ACTION_VIEW, "file://") Intent1.SetType("application/pdf") For Each cn As String In pm.queryIntentActivities (Intent1) Log(cn) Next
Sergey_New Well-Known Member Licensed User Longtime User Apr 29, 2023 #5 JohnC, thanks! It works! Upvote 0