Android and android Official Website
Determine the specific action of intent-filter
Address: http://blog.csdn.net/caroline_wendy
If you useStartIntent () Start ActivityIfIntent-filter does not include this action, The system will crash abnormally. You can check before using it:
// Determine whether to install the [health tool] private boolean isInstallChunyuTools () {Intent cardioFaceIntent = new Intent (EtonConstants. CHUNYU_CARDIO_FACE_ACTION); Intent pedometerIntent = new Intent (EtonConstants. CHUNYU_PEDOMETER_ACTION); PackageManager pm = getPackageManager (); List <ResolveInfo> cardioFaceInfos = pm. queryIntentActivities (cardioFaceIntent, PackageManager. GET_RESOLVED_FILTER); List <ResolveInfo> pedometerInfos = pm. queryIntentActivities (pedometerIntent, PackageManager. GET_RESOLVED_FILTER); return cardioFaceInfos. isEmpty () | pedometerInfos. isEmpty ();}
Reference: http://stackoverflow.com/questions/20809237/android-search-installed-package-with-intent-filter
Heck out
QueryIntentActivities ()So you create an intent with the correct filter matching discriminators on it.
Intent intent = new Intent("my_awesome.package.hasa.custom.ACTION!");intent.addCategory("typingisfunfunfun");intent.setData(Uri.parse("data://foo/bar"));PackageManager pm = getPackageManager();List<ResolveInfo> resolveInfos = pm.queryIntentActivities(intent, PackageManager.GET_RESOLVED_FILTER);if(resolveInfo.isEmpty()) { Log.i("NoneResolved", "No Activities");} else { Log.i("Resolved!", "There are activities" + resolveInfos);}