Android check for dependent application during installation?
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.
Thanks in advance
Rajesh
如果您知道您正在查找的应用程序的软件包名称,则可以使用PackageManager来测试应用程序的存在。
try{
ApplicationInfo info = getPackageManager()
.getApplicationInfo("com.myproject", 0 );
//-- application exists
} catch( PackageManager.NameNotFoundException e ){
//-- application doesn't exist
}
In case XYZ is a shared library , you may set-up the android manifest of your application to prevent users installing ABC without XYZ. Please use the element inside the AndroidManifest.xml of ABC, by stating:
<uses-library android:name="package name of XYZ" android:required="true" />
Hope this help your problem.
链接地址: http://www.djcxy.com/p/41874.html