Example usage for android.content.pm PackageManager MATCH_DEFAULT_ONLY

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

Introduction

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

Prototype

int MATCH_DEFAULT_ONLY

To view the source code for android.content.pm PackageManager MATCH_DEFAULT_ONLY.

Click Source Link

Document

Resolution and querying flag: if set, only filters that support the android.content.Intent#CATEGORY_DEFAULT will be considered for matching.

Usage

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 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 hasPreferredApplication(final Context context, final Intent intent) {
    PackageManager pm = context.getPackageManager();
    ResolveInfo info = pm.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY);
    return !"android".equals(info.activityInfo.packageName);
}

From source file:Main.java

protected static boolean isAvailable(Intent intent, Context context) {
    List<ResolveInfo> infos = context.getPackageManager().queryIntentActivities(intent,
            PackageManager.MATCH_DEFAULT_ONLY);
    if (infos.size() > 0)
        return true;
    else/*from w w  w  .  jav a  2 s . co m*/
        return false;
}

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

private static boolean isKnownBrowser(Context context, Intent i) {
    ResolveInfo resolvedActivity = context.getPackageManager().resolveActivity(i,
            PackageManager.MATCH_DEFAULT_ONLY);
    if (resolvedActivity == null) {
        // No browser
        return false;
    }//from   w  w  w . j  a  v  a2  s .  com

    String name = resolvedActivity.activityInfo.name;
    if (name == null) {
        return false;
    }

    name = name.toLowerCase();
    return name.contains("chrome") || name.contains("firefox");
}

From source file:Main.java

public static boolean isIntentAvailable(Context context, Intent i) {
    final PackageManager packageManager = context.getPackageManager();
    List<ResolveInfo> list = packageManager.queryIntentActivities(i, PackageManager.MATCH_DEFAULT_ONLY);
    return list.size() > 0;
}

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 boolean isPackageExistAndHasAction(Context context, String pkgName, String action) {
    if (isPackageExist(context, pkgName) && context.getPackageManager()
            .queryIntentActivities(new Intent(action), PackageManager.MATCH_DEFAULT_ONLY).size() > 0) {
        return true;
    }/*from  ww  w.j  av  a2s . c om*/
    return false;
}