I want to use OpenIntents.org intents in my applications. How can I ensure that the receiving application is installed on the user's phone?
It looks like http://openintents.org has a lot of promise and could save me a lot of wheel reinventing.
When using openi开发者_如何学运维ntents in my Android apps, how can I make sure that the appropriate openintents apps are installed to receive those intents?
For example, there is an open intent for a file picker: http://www.openintents.org/en/node/164, if I use this, or another intent like it, how can I be sure everything will work? (Please note that i'm interested in the general use of open intents, and not in file choosing strategies.)
I'd really like to be able to use these in my apps because it would save tremendous amounts of time. Thanks for looking.
This can be used to see if there is an Activity that can handle the intent.
Intent intent = new Intent(Intent.ACTION_VIEW, someTypeOfUri);
List<ResolveInfo> list = getPackageManager().queryIntentActivities(intent,
PackageManager.MATCH_DEFAULT_ONLY);
if(list.size() > 0) {
//intent will be handled
}
精彩评论