Android Utililty Methods Intent Check

List of utility methods to do Intent Check

Description

The list of methods to do Intent Check are organized into topic(s).

Method

booleanisExternalStorageDocument(Uri uri)
is External Storage Document
return "com.android.externalstorage.documents".equals(uri
        .getAuthority());
booleanisMediaDocument(Uri uri)
is Media Document
return "com.android.providers.media.documents".equals(uri
        .getAuthority());
booleanisCallable(Context c, Intent intent)
is Callable
List<ResolveInfo> list = c.getPackageManager()
        .queryIntentActivities(intent,
                PackageManager.MATCH_DEFAULT_ONLY);
return list.size() > 0;
booleanisCommonIntentUrl(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:");
booleanisIntentAvailable(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;
booleanisIntentUrl(String url)
is Intent Url
return isCommonIntentUrl(url) || isPlayMarketIntentUrl(url);
booleanisPlayMarketIntentUrl(String url)
is Play Market Intent Url
return url.startsWith("market:");
booleanisIntentAvailable(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;
booleanisIntentAvailable(@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;