We have the following code:

                PackageManager packageManager = context.getPackageManager();
                Intent testIntent = new Intent(Intent.ACTION_VIEW);
                testIntent.setType("application/pdf");
                List<ResolveInfo> list =
packageManager.queryIntentActivities(testIntent,
PackageManager.MATCH_DEFAULT_ONLY);
                int pdfViewerCount = list.size();
                if (pdfViewerCount == 0) {
                   <print nasty message>
                }

For some reason, on an HTC Evo, this code returns zero for
pdfViewerCount when only the default PDF viewer is installed.  Here is
the default viewer:

Activity Resolver Table:
  Full MIME Types:
      application/pdf:
        45f9e688 com.htc.pdfreader/.ActPDFReader filter 45f819f0

  Base MIME Types:
      application:
        45f9e688 com.htc.pdfreader/.ActPDFReader filter 45f819f0

  Schemes:
      file:
        45f9e688 com.htc.pdfreader/.ActPDFReader filter 45f819f0
      content:
        45f9e688 com.htc.pdfreader/.ActPDFReader filter 45f819f0

  Non-Data Actions:
      android.intent.action.SEARCH:
        45f9e688 com.htc.pdfreader/.ActPDFReader filter 45f76eb0
      android.intent.action.MAIN:
        45f9e688 com.htc.pdfreader/.ActPDFReader filter 45f952c0
        45f696f8 com.htc.pdfreader/.MyFilePickerActivity filter
45f64d50

  MIME Typed Actions:
      android.intent.action.VIEW:
        45f9e688 com.htc.pdfreader/.ActPDFReader filter 45f819f0

Receiver Resolver Table:
  Schemes:
      file:
        45f3ef78 com.htc.pdfreader/.MediaBroadcastReceiver filter
45f3d1b0

Packages:
  Package [com.htc.pdfreader] (45fab438):
    userId=10077 gids=[]
    sharedUser=null
    pkg=Package{46275e58 com.htc.pdfreader}
    codePath=/system/app/PDFViewer.apk
    resourcePath=/system/app/PDFViewer.apk
    dataDir=/data/data/com.htc.pdfreader
    targetSdk=8
    supportsScreens=[medium, large, small, resizeable, anyDensity]
    timeStamp=1281017266000
    signatures=PackageSignatures{45fb6710 [45fb1780]}
    permissionsFixed=false haveGids=true
    pkgFlags=0x1 installStatus=1 enabled=0
    grantedPermissions:
      android.permission.MOUNT_UNMOUNT_FILESYSTEMS

Registered ContentProviders:
  [com.htc.pdfreader.PdfSuggestionProvider]: Provider{45f47660
com.htc.pdfreader.PdfSuggestionProvider}


Why would this viewer not be found???

(The meaning of MATCH_DEFAULT_ONLY is unclear to me, but it appears to
imply that only apps that would respond to a vanilla "click" on the
file in a file list should be selected.  Surely the default PDF viewer
would respond to this, no?)

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to