android从jni获取我的应用程序的PackageInfo

时间:2013-10-28 05:16:43

标签: android c++ java-native-interface

获取包信息的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 ++获取我的应用程序包信息的方法吗?

0 个答案:

没有答案