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 app
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
}
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.