大家好我对android编程有疑问:
如果我在谷歌玩2个应用程序用户下载应用程序(1)之一,我怎么知道用户设备是否有应用程序(2)
我不会在用户设备中有app(2),app(1)显示Toast并说
“app app(2)is install”
或
“你有应用程序编号(2)谢谢”
答案 0 :(得分:0)
你可以这样检查,
PackageManager localPackageManager = getPackageManager();
// Main thing is it will return the launcher, If the app dont have launcher, use getPackageInfo(package, 0) will NameNotFoundException if no package
Intent launchIntent = localPackageManager.getLaunchIntentForPackage("[Seconf app package name]");
if (launchIntent != null) {
// the app number (2) is install
} else {
// not installed.
}