veesong
5/15/2018 - 7:41 AM

获取Android的16进制签名(非keystore文件)

private String getSign() {
    PackageManager pm = getPackageManager();
    List<PackageInfo> apps = pm.getInstalledPackages(PackageManager.GET_SIGNATURES);
    Iterator<PackageInfo> iter = apps.iterator();
    while (iter.hasNext()) {
        PackageInfo packageinfo = iter.next();
        String packageName = packageinfo.packageName;
        if (packageName.equals(getPackageName())) {
            return packageinfo.signatures[0].toCharsString();
        }
    }
    return null;
}