private boolean isAnyPackageFromListInstalled ( List < String > packages ) { boolean result = false ; PackageManager pm = mContext . getPackageManager ( ) ; for ( String packageName : packages ) { try { // Root app detected pm . getPackageInfo ( packageName , 0 ) ; QLog . e ( packageName + " ROOT management app detected!" ) ; result = true ; } catch ( PackageManager . NameNotFoundException e ) { // Exception thrown, package is not installed into the system } } return result ; }
Check if any package in the list is installed