code: public static boolean hasHandler(Context context, Intent intent) {
          List<ResolveInfo> handlers = context.getPackageManager().queryIntentActivities(intent, 0);
          return !handlers.isEmpty();
      }
docs: Queries on-device packages for a handler for the supplied {@link Intent}.