The PackageManager.getPackageInfo(packageName, flags)
method can be used to check whether a specific package has been installed. It either returns the PackageInfo or throws PackageManager.NameNotFoundException
.
How to check if a library APK is installed? An example of the library APK is Trichrome Library: https://www.apkmirror.com/apk/google-inc/trichrome-library/trichrome-library-98-0-4758-101-release/trichrome-library-98-0-4758-101-3-android-apk-download/download/
After installation of this APK, calling PackageManager.getPackageInfo('com.google.android.trichromelibrary', 0)
throws PackageManager.NameNotFoundException
.
Looking via ADB, I see that once installed, it's not visible under pm list packages
but it's visible under pm list libraries
with the name "library:com.google.android.trichromelibrary".
Is there any way to determine programmatically whether the library has been installed?