Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check signature of an apk

Tags:

android

apk

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?

like image 948
Martin Dusek Avatar asked Nov 04 '25 12:11

Martin Dusek


1 Answers

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

like image 172
Tobias Hellmann Avatar answered Nov 06 '25 04:11

Tobias Hellmann



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!