This code works regardless in which package the action is located.

The only improvement I would suggest is to change the last argument
form
String action
to
Intent intent
and omit the line " final Intent intent = new Intent(action); "

Then you can search for arbitrary intents that you want to launch,
including those that use data or a mime type.

(here is the modified source:
http://code.google.com/p/openintents/source/browse/trunk/NotePad/src/org/openintents/util/IntentUtils.java
)

Peli
www.openintents.org


On Jun 26, 11:02 am, ani <[email protected]> wrote:
> Hi All,
>
> I have a query to ask.This piece of code i have come across in one of
> the posts (http://android-developers.blogspot.com/search/label/How-to
> by Romain Guy )  in which author has said
>
> "simple way to find out whether the system contains any application
> capable of responding to the intent you want to use".
>
> public static boolean isIntentAvailable(Context context, String
> action) {
>     final PackageManager packageManager = context.getPackageManager();
>     final Intent intent = new Intent(action);
>     List<ResolveInfo> list =
>             packageManager.queryIntentActivities(intent,
>                     PackageManager.MATCH_DEFAULT_ONLY);
>     return list.size() > 0;
>
> }
>
> But this code is working only if my androidmanifest.xml file has the
> particular intent{isIntentAvailable(this,action =
> ("com.android.aaaa")--this string is defined as intent filter in my
> androidmanifest.xml )}.
>
> However this is not working if i am trying to find out an intent which
> is in some other apk and this "other apk" is installed in my
> system.Can i do this using the code shown above or it is not possible?
>
> regards,
> ani
--~--~---------~--~----~------------~-------~--~----~
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