List of usage examples for android.content.pm PackageManager MATCH_ALL
int MATCH_ALL
To view the source code for android.content.pm PackageManager MATCH_ALL.
Click Source Link
From source file:Main.java
@TargetApi(Build.VERSION_CODES.M) public static List<String> getCustomTabSupportingPackages(Context context) { PackageManager pm = context.getPackageManager(); Intent activityIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.example.com")); // Get all apps that can handle VIEW intents. List<ResolveInfo> resolvedActivityList = pm.queryIntentActivities(activityIntent, PackageManager.MATCH_ALL); List<String> packagesSupportingCustomTabs = new ArrayList<>(); for (ResolveInfo info : resolvedActivityList) { Intent serviceIntent = new Intent(); serviceIntent.setAction(ACTION_CUSTOM_TABS_CONNECTION); serviceIntent.setPackage(info.activityInfo.packageName); if (pm.resolveService(serviceIntent, 0) != null) { packagesSupportingCustomTabs.add(info.activityInfo.packageName); }/* w ww . j a v a 2 s. c o m*/ } return packagesSupportingCustomTabs; }
From source file:com.nadmm.airports.utils.SystemUtils.java
public static boolean canDisplayMimeType(Context context, String mimeType) { PackageManager pm = context.getPackageManager(); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setType(mimeType);/*from w w w. ja va 2 s.co m*/ List<ResolveInfo> list = pm.queryIntentActivities(intent, PackageManager.MATCH_ALL); return !list.isEmpty(); }
From source file:com.waz.zclient.pages.main.conversation.AssetIntentsManager.java
private void openDocument(String mimeType, IntentType tpe) { if (BuildConfig.IS_TEST_GALLERY_ALLOWED) { // trying to load file from testing gallery, // this is needed because we are not able to override DocumentsUI on some android versions. Intent intent = new Intent("com.wire.testing.GET_DOCUMENT").setType(mimeType); if (!pm.queryIntentActivities(intent, PackageManager.MATCH_ALL).isEmpty()) { callback.openIntent(intent, tpe); return; }//from w w w . j a va2s. c o m Timber.i("Did not resolve testing gallery for intent: %s", intent.toString()); } callback.openIntent( new Intent(openDocumentAction()).setType(mimeType).addCategory(Intent.CATEGORY_OPENABLE), tpe); }
From source file:arun.com.chromer.browsing.customtabs.CustomTabs.java
/** * Returns all valid custom tab supporting browser packages on the system. Does not respect if * the package is default or not./*from w ww .j a v a 2 s. c o m*/ * * @param context context to work with * @return list of packages supporting CCT */ @TargetApi(Build.VERSION_CODES.M) @NonNull public static List<String> getCustomTabSupportingPackages(Context context) { final PackageManager pm = context.getApplicationContext().getPackageManager(); final Intent activityIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.example.com")); // Get all apps that can handle VIEW intents. final List<ResolveInfo> resolvedActivityList = pm.queryIntentActivities(activityIntent, PackageManager.MATCH_ALL); final List<String> packagesSupportingCustomTabs = new ArrayList<>(); for (ResolveInfo info : resolvedActivityList) { if (isPackageSupportCustomTabs(context, info.activityInfo.packageName)) { packagesSupportingCustomTabs.add(info.activityInfo.packageName); } } return packagesSupportingCustomTabs; }
From source file:android.support.customtabs.browseractions.BrowserActionsIntent.java
/** * Check whether any Browser Actions provider is available to handle the {@link * BrowserActionsIntent}.//from w w w . j av a 2 s.c o m * @param context The context requesting for a Browser Actions menu. * @return true If a Browser Actions provider is available handle the intent. */ private static boolean hasBrowserActionsIntentHandler(Context context) { Intent intent = new Intent(BrowserActionsIntent.ACTION_BROWSER_ACTIONS_OPEN, Uri.parse(TEST_URL)); PackageManager pm = context.getPackageManager(); List<ResolveInfo> resolveInfoList = pm.queryIntentActivities(intent, PackageManager.MATCH_ALL); return resolveInfoList.size() > 0 ? true : false; }
From source file:com.tct.email.NotificationController.java
public boolean isIntentExisting(Context context, String action) { final PackageManager packageManager = context.getPackageManager(); final Intent intent = new Intent(action); List<ResolveInfo> resolveInfo = packageManager.queryIntentActivities(intent, PackageManager.MATCH_ALL); return resolveInfo.size() > 0; }