/**
* 判断apk是否已经安装
* @param uri apk包名
* @return
*/
private boolean 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.adobe.air")){
Toast.makeText(getApplicationContext(), "已经安装Adodeair插件",Toast.LENGTH_SHORT).show();
}else{
Toast.makeText(getApplicationContext(), "没有安装Adodeair插件",Toast.LENGTH_SHORT).show();
}
时间: 2024-11-10 14:33:09