Android的检查在安装过程中依赖的应用程序? [英] Android check for dependent application during installation?

查看:179
本文介绍了Android的检查在安装过程中依赖的应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

喜    我要发布我的应用程序(ABC)。它的有声读物文件(只是举例)包装成的apk。当用户安装该应用程序需要检查是否另一个应用(XYZ)已安装或没有。如果不是让用户知道他们必须在安装之前,农行首次安装应用程序XYZ。

Hi I want to publish my application (ABC). Its an audiobook file(just for example.) wrapped as apk. When the user install this application it needs to check whether another application (XYZ) already installed or not. If not let the user know they have to install the application XYZ first before installing ABC.

在此先感谢

拉​​杰什

推荐答案

如果你知道你正在寻找可以使用PackageManager来测试应用程序的存在应用程序的包名。

If you know the package name of the application you are looking for you can use the PackageManager to test for the existence of an application.

try{
     ApplicationInfo info = getPackageManager()
                             .getApplicationInfo("com.myproject", 0 );
     //-- application exists
    } catch( PackageManager.NameNotFoundException e ){
     //-- application doesn't exist
}

这篇关于Android的检查在安装过程中依赖的应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆