List of utility methods to do Intent Check
boolean | isExternalStorageDocument(Uri uri) is External Storage Document return "com.android.externalstorage.documents".equals(uri .getAuthority()); |
boolean | isMediaDocument(Uri uri) is Media Document return "com.android.providers.media.documents".equals(uri .getAuthority()); |
boolean | isCallable(Context c, Intent intent) is Callable List<ResolveInfo> list = c.getPackageManager()
.queryIntentActivities(intent,
PackageManager.MATCH_DEFAULT_ONLY);
return list.size() > 0;
|
boolean | isCommonIntentUrl(String url) is Common Intent Url return url.startsWith("tel:") || url.startsWith("voicemail:") || url.startsWith("sms:") || url.startsWith("mailto:") || url.startsWith("geo:") || url.startsWith("google.streetview:"); |
boolean | isIntentAvailable(final Context context, final String action) is Intent Available final PackageManager packageManager = context.getPackageManager(); final Intent intent = new Intent(action); final List<ResolveInfo> list = packageManager .queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); return list.size() > 0; |
boolean | isIntentUrl(String url) is Intent Url return isCommonIntentUrl(url) || isPlayMarketIntentUrl(url);
|
boolean | isPlayMarketIntentUrl(String url) is Play Market Intent Url return url.startsWith("market:"); |
boolean | isIntentAvailable(Context context, String action) Check if action available installed 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; |
boolean | isIntentAvailable(@Nonnull Context context, @Nonnull String action) Checks whether an action has a matching Intent in the current device final PackageManager packageManager = context.getPackageManager(); final Intent intent = new Intent(action); List<ResolveInfo> list = packageManager.queryIntentActivities( intent, PackageManager.MATCH_DEFAULT_ONLY); return list.size() > 0; |