Android checks if the specified software is installed on the phone (based on package name detection)
/** * Check if the specified software is installed on the phone * @param context* @param packagename* @return*/ Public StaticBoolean isavilible (context context, String PackageName) {final Packagemanager Packagemanager=Context.getpackagemanager (); List<PackageInfo> PackageInfos = Packagemanager.getinstalledpackages (0); List<String> Packagenames =NewArraylist<string>(); if(PackageInfos! =NULL) { for(inti =0; I < packageinfos.size (); i++) {String packname= PackageInfos.Get(i). PackageName; Packagenames.add (Packname); } } //determine if there is a package name for the target program in Packagenames, there is true, no false returnPackagenames.contains (PackageName);}
Android checks if the specified software is installed on the phone (based on package name detection)