Android 判断某个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
}

发表评论?

0 条评论。

发表评论


注意 - 你可以用以下 HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>