Can I test to see if an application is avaliable to handle an intent, without starting it?

前端 未结 2 482

Specifically, I\'m trying to figure out if there is an application to handle the market intent, but I\'d like a general case solution.

I know if you do something lik

2条回答
  •  星月不相逢
    2021-01-14 12:26

    Use PackageManager and queryIntentActivities() or resolveActivity(). The former will return a List of things that match an Intent to be used with startActivity(). The latter will return null for no matches or an Intent which is the "best match" (which could be the chooser activity if there is more than one match).

提交回复
热议问题