Android的 - 检查的其他应用程序presence应用程序、Android、presence

由网友(已风干的迷茫)分享简介:我工作的一个应用程序,扩展了另外一个功能,现有的应用程序。我想知道最简单的方法是确定的,通过code,第一个应用程序是否安装,preferably由com.whoever.whatever引用,但几乎所有的标准将是有益的。解决方案 android.content.pm.PackageManager MPM = g...

我工作的一个应用程序,扩展了另外一个功能,现有的应用程序。我想知道最简单的方法是确定的,通过code,第一个应用程序是否安装,preferably由com.whoever.whatever引用,但几乎所有的标准将是有益的。

解决方案

  android.content.pm.PackageManager MPM = getPackageManager(); // 1
PackageInfo信息= mPm.getPackageInfo(PNAME,0); // 2,3
布尔安装=信息!= NULL;
 

用在一个活动,你需要一个环境来获得PackageManager 在抛出 PackageManager.NameNotFoundException ,我猜。检查! PNAME是像'com.yourcompany.appname,同为一揽子的应用程序的清单价值

I'm working on an app that extends the functionality of another, existing app. I want to know what the easiest way is to determine, through code, whether the first app is installed, preferably by referencing it by com.whoever.whatever but almost any criteria would be helpful.

解决方案 Android应用程序信息查看工具

android.content.pm.PackageManager mPm = getPackageManager();  // 1
PackageInfo info = mPm.getPackageInfo(pName, 0);  // 2,3
Boolean installed = info != null;

Used in an activity, you need a context to get the PackageManager Throws PackageManager.NameNotFoundException, I guess. check! pName is something like 'com.yourcompany.appname', the same as the value of 'package' in the manifest of the app

阅读全文

相关推荐

最新文章