Android Question Find out if the user's device has a PDF viewer?

Sergey_New

Well-Known Member
Licensed User
Longtime User
Please tell me how to find out if there is a PDF viewer on the user's device?
 
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:
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
This posts might help you...

 
Last edited:
Upvote 0

Sergey_New

Well-Known Member
Licensed User
Longtime User
Thanks, checked:
B4X:
    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:
pm.QueryIntentActivities(in1).size=0
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
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:
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
Cookies are required to use this site. You must accept them to continue using the site. Learn more…