I'm developing an Android app that has the ability of installing additional apps (which act as plugins for my app) if the user requires it.
However, each of these additional apps may require a specific Android version to run. I would like to perform a check at runtime to see if the APK I'm trying to install is actually compatible with the device.
Now, with the following method:
public PackageManager getPackageArchiveInfo(String archiveFilePath, int flags)
I can get info on an APK file. However, the problem is that the returned information seems to only include the APK's targetSdkVersion
but not the minSdkVersion
, which to my understanding is the one that actually determines the minimum version of Android an app can be installed/run on. The targetSdkVersion
if I understand correctly is just the "optimal" version.
So, long story short, how can I determine whether an APK cna run on the device from Android itself? (I know I can use AAPT on desktop, but that is not available on Android itself)