Andoird判断某个APK是否已经安装

 

privateboolean isAppInstalled(String uri){
PackageManager pm = getPackageManager();
boolean installed =false;
try{
pm.getPackageInfo(uri,PackageManager.GET_ACTIVITIES);
installed =true;
}catch(PackageManager.NameNotFoundException e){
installed =false;
}
return installed;
}

 

只是调用了这个方法,通过你需要检查应用程序包的名称。

 

if(isAppInstalled("com.yourpackage.package")){
//app installed
}
else{
//app not installed
}

 

你可能感兴趣的:(Android)