开发者

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?

开发者 https://www.devze.com 2023-02-22 20:27 出处:网络
It looks like http://openintents.org has a lot of promise and could save me a lot of wheel reinventing.

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
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号