Application not found by queryIntentActivities

by DanH » Tue, 05 Oct 2010 02:18:06 GMT


Sponsored Links
 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?)

--



Application not found by queryIntentActivities

by Mark Murphy » Tue, 05 Oct 2010 02:24:49 GMT


 


Have you tried with 0 in place of MATCH_DEFAULT_ONLY? Perhaps that
activity does not have the default category specified in its intent
filter.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://github.com/commonsguy 
 http://commonsware.com/blog  |  http://twitter.com/commonsguy 

Android Training...At Your Office:  http://commonsware.com/training 

--


Sponsored Links


Application not found by queryIntentActivities

by DanH » Tue, 05 Oct 2010 02:39:15 GMT


 Just tried it with zero.  Fails the same way.  (And the code works
fine on other phones.)






--



Application not found by queryIntentActivities

by DanH » Tue, 05 Oct 2010 02:44:10 GMT


 And, if we skip the test and let the code continue on, a PDF is
successfully displayed through a simple startActivity with an intent
for ACTION_VIEW on a PDF file.






--



Application not found by queryIntentActivities

by DanH » Tue, 05 Oct 2010 04:07:24 GMT


 Ran another experiment where I made the intent passed to query exactly
match the one that works to start the activity later.  Still no joy.






--



Application not found by queryIntentActivities

by DanH » Tue, 05 Oct 2010 04:47:48 GMT


 Well of course there was a coding error in that last experiment.  When
I pass a file with the intent then the HTC viewer is happy to
acknowledge its existence.  So to be reasonably certain of finding all
apps that can handle an intent apparently you have to create the
complete intent.







--



Application not found by queryIntentActivities

by Mark Murphy » Tue, 05 Oct 2010 05:04:09 GMT


 


It probably has a <data> element in its <intent-filter> that was not
matching your previous Intent.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://github.com/commonsguy 
 http://commonsware.com/blog  |  http://twitter.com/commonsguy 

Android Training...At Your Office:  http://commonsware.com/training 

--



Other Threads

1. Structure of tables

Hi,
Does any one know structure of tables in Android? I know structure of
table sms (content://sms/):
_id, thread_id, address, person, date, protocol, read, status, type,
reply_path_present, subject, body, service_center.

Does any one know structure of the rest sms tables? and what tables
are in Android ?

Thanks


--~--~---------~--~----~------------~-------~--~----~

2. Location.convert possible bug

I'm getting an illegal argument exception when trying to convert a
coordinate in degrees:minutes:seconds.decimal format with the minute
value is 59 and the seconds is greater than 0.  I think the function
compares seconds and they must be less than 59, where they should be
less than 60.

Here is the error with the coordinate:

05-13 22:27:57.071: ERROR/AndroidRuntime(3924): Caused by:
java.lang.IllegalArgumentException: coordinate=30:26:59.5644
05-13 22:27:57.071: ERROR/AndroidRuntime(3924):     at
android.location.Location.convert(Location.java:249)

Please let me know if this is a bug or a feature :-)

thanks

--~--~---------~--~----~------------~-------~--~----~

3. Cascading deletion?

4. Bouygues Telecom - France

5. Animated progress in Imageview

6. Any plans to support Microsoft's ActiveSync protocol?

7. Enable PVLOGGER