Here you can find the source of isIntentAvailable(Context context, String action)
Parameter | Description |
---|---|
context | Context of current app |
action | Package of application to check |
public static boolean isIntentAvailable(Context context, String action)
//package com.java2s; // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import java.util.List; public class Main { /**/*from w w w . j a v a2 s .c om*/ * Check if action available installed * * @param context Context of current app * @param action Package of application to check * @return true if passed package installed */ public static boolean isIntentAvailable(Context context, String action) { final PackageManager packageManager = context.getPackageManager(); final Intent intent = new Intent(action); assert packageManager != null; List<ResolveInfo> list = packageManager.queryIntentActivities( intent, PackageManager.MATCH_DEFAULT_ONLY); return list.size() > 0; } }