Example usage for android.content.pm PackageManager queryIntentActivities

List of usage examples for android.content.pm PackageManager queryIntentActivities

Introduction

In this page you can find the example usage for android.content.pm PackageManager queryIntentActivities.

Prototype

public abstract List<ResolveInfo> queryIntentActivities(Intent intent, @ResolveInfoFlags int flags);

Source Link

Document

Retrieve all activities that can be performed for the given intent.

Usage

From source file:Main.java

public static List<ResolveInfo> getAvailableAppsForIntent(Context context, Intent intent) {
    PackageManager packageManager = context.getPackageManager();
    return packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
}

From source file:Main.java

public static int queryIntentActivitiesSize(Context ctx, Intent intent) {
    PackageManager packageManager = ctx.getPackageManager();
    List list = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
    return list.size();
}

From source file:Main.java

public static List<ResolveInfo> getShareTargets(Context ctx) {
    Intent intent = new Intent(Intent.ACTION_SEND, null);
    intent.addCategory(Intent.CATEGORY_DEFAULT);
    intent.setType("text/plain");
    PackageManager pm = ctx.getPackageManager();
    return pm.queryIntentActivities(intent, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT);
}

From source file:Main.java

public static boolean intentAvailable(Context context, Intent intent) {
    PackageManager packageManager = context.getPackageManager();
    List list = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
    return list.size() > 0;
}

From source file:Main.java

public static boolean intentIsAvailable(Context ctx, Intent intent) {
    final PackageManager mgr = ctx.getPackageManager();
    List<ResolveInfo> list = mgr.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
    return list.size() > 0;
}

From source file:Main.java

public static boolean isActivityExist(Context context, Intent intent) {
    if (context != null && intent != null) {
        PackageManager var2 = context.getPackageManager();
        List var3 = var2.queryIntentActivities(intent, 0);
        return var3.size() != 0;
    } else {/* w ww.  j  ava2 s  . c  om*/
        return false;
    }
}

From source file:Main.java

public static boolean checkImplicitIntent(Context context, Intent intent) {
    PackageManager pm = context.getPackageManager();
    List<ResolveInfo> apps = pm.queryIntentActivities(intent, 0);
    return apps.size() > 0;
}

From source file:Main.java

public static boolean isMyServiceInstalled(Context ctx, Intent intent) {
    final PackageManager mgr = ctx.getPackageManager();
    List<ResolveInfo> list = mgr.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
    return list.size() > 0;
}

From source file:Main.java

public static boolean fileTypeCanBeOpened(PackageManager manager, Intent intent) {
    List<ResolveInfo> infos = manager.queryIntentActivities(intent, 0);
    return infos.size() > 0;

}

From source file:Main.java

private static boolean intentAvailable(Context context, Intent intent) {
    PackageManager packageManager = context.getPackageManager();
    List list = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
    return list.size() > 0;
}