public class AndroidPackageInfoFetcher extends Object
PackageManager
.
Visible for testing.Constructor and Description |
---|
AndroidPackageInfoFetcher(Context context) |
Modifier and Type | Method and Description |
---|---|
List<String> |
getCertFingerprints(String packageName)
Returns the Sha-256 fingerprints of all certificates from the specified package as a list of
upper case HEX Strings with bytes separated by colons.
|
List<String> |
getStatements(String packageName)
Returns all statements that the specified package makes in its AndroidManifest.xml.
|
public AndroidPackageInfoFetcher(Context context)
public List<String> getCertFingerprints(String packageName) throws PackageManager.NameNotFoundException
Signature
, the fingerprint can be computed as Utils.computeNormalizedSha256Fingerprint(byte[])
.
Given a signed APK, Java 7's commandline keytool can compute the fingerprint using: keytool -list -printcert -jarfile signed_app.apk
Example: "10:39:38:EE:45:37:E5:9E:8E:E7:92:F6:54:50:4F:B8:34:6F:C6:B3:46:D0:BB:C4:41:5F:C3:39:FC:FC:8E:C1"
PackageManager.NameNotFoundException
- if an app with packageName is not installed on the device.public List<String> getStatements(String packageName) throws PackageManager.NameNotFoundException
PackageManager.NameNotFoundException
- if the app is not installed on the device.