[英]How to check the presence of app in android device?
I'm working on a VoIP SDK.我正在研究 VoIP SDK。 A device may contain more than one app having my SDK.
一台设备可能包含多个拥有我的 SDK 的应用程序。 I want to know the Presence of App A from App B .
我想从 App B知道App A的存在。 Is that possible with or without using any device permission?
无论是否使用任何设备许可,这都可能吗?
Though I don't receive any answer, So I'm giving the easiest solution applied by me.虽然我没有收到任何答案,所以我给出了我应用的最简单的解决方案。 Use PackageManager to get presense of other app.
使用 PackageManager 获取其他应用程序的存在。 All you need is ApplicationID of that app.
您只需要该应用程序的ApplicationID 。
android.content.pm.PackageManager mPm = getPackageManager();
PackageInfo info = null;
try {
info = mPm.getPackageInfo("<Put applicationID here>", 0);
Boolean installed = info != null;
Log.d("TAG","isInstalled : "+ "" + installed);
} catch (PackageManager.NameNotFoundException e) {
Log.d("TAG","not Installed");
e.printStackTrace();
}
If no application found with respect to applicationId passed, control would go to catch block.如果没有找到与 applicationId 相关的应用程序,则控制将转到 catch 块。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.