I want to read signatures of an .apk file that is locally stored on a device. I use.
PackageInfo packageInfo = getPackageManager().getPackageArchiveInfo(apkFilePath, PackageManager.GET_SIGNING_CERTIFICATES)
It returns packageInfo but always with null signingInfo field.
How to get signing info for apk file?
Not a real solution but it seems to be fixed in Android 11 / 12.
On my Android 11 and 12 emulators, packageInfo.signingInfo is not null.
But on my Android 9 and 10 emulators, packageInfo.signingInfo is null.
So I'm using GET_SIGNING_CERTIFICATES only when SDK_INT >= Build.VERSION_CODES.R
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With