Check if there is an exported activity for the intent
This commit is contained in:
parent
a7a2043682
commit
ce2125e647
@ -9,10 +9,18 @@ import java.util.List;
|
|||||||
|
|
||||||
public class IntentUtils {
|
public class IntentUtils {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Checks if there is at least one exported activity that can be performed for the intent
|
||||||
|
*/
|
||||||
public static boolean isCallable(final Context context, final Intent intent) {
|
public static boolean isCallable(final Context context, final Intent intent) {
|
||||||
List<ResolveInfo> list = context.getPackageManager().queryIntentActivities(intent,
|
List<ResolveInfo> list = context.getPackageManager().queryIntentActivities(intent,
|
||||||
PackageManager.MATCH_DEFAULT_ONLY);
|
PackageManager.MATCH_DEFAULT_ONLY);
|
||||||
return list.size() > 0;
|
for(ResolveInfo info : list) {
|
||||||
|
if(info.activityInfo.exported) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user