Android获取apk程序签名信息代码示例
时间:2020-12-30 13:09:29|栏目:Android代码|点击: 次
复制代码 代码如下:
这是获取apk包的签名信息
private String getSign(Context context) {
PackageManager pm = context.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;
return packageinfo.signatures[0].toCharsString();
if (packageName.equals(instance.getPackageName())) {
MediaApplication.logD(DownloadApk.class, packageinfo.signatures[0].toCharsString());
return packageinfo.signatures[0].toCharsString();
}
}
return null;
}
返回的签名信息结果为很长的一串数据
栏 目:Android代码
本文地址:http://www.codeinn.net/misctech/38240.html