Android check for dependent application during installation?

后端 未结 2 1403
抹茶落季
抹茶落季 2020-12-19 06:02

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

相关标签:
2条回答
  • 2020-12-19 06:38

    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
    }
    
    0 讨论(0)
  • 2020-12-19 06:40

    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.

    0 讨论(0)
提交回复
热议问题