获取包信息的Java代码:
/**
* get PackageInfo
* @param context
* @return
*/
public PackageInfo getPackageSign(Context context) {
PackageManager pm = context.getPackageManager();
List<PackageInfo> apps = pm.getInstalledPackages(PackageManager.GET_SIGNATURES);
Iterator<PackageInfo> iter = apps.iterator();
while (iter.hasNext()) {
PackageInfo info = iter.next();
String packageName = info.packageName;
if (packageName.equals("your package name")) {
return info;
}
}
return null;
}
这是用jni中的c ++获取我的应用程序包信息的方法吗?