2 aiik01 AIIK01 于 2014.04.10 18:14 提问

获取静态apk包(未安装)的packagename

frameworks\base\services\java\com\android\server\pm\PackageManagerService.java
installPackageWithVerificationAndEncryption(...)方法中 获取静态apk包(未安装)的packagename.....
具体方法如下:
final String archiveFilePath = packageURI.getPath();
PackageParser pp = new PackageParser(archiveFilePath);
File sourceFile = new File(archiveFilePath);
DisplayMetrics metrics = new DisplayMetrics();
metrics.setToDefaults();
PackageParser.Package pkg = pp.parsePackage(sourceFile,
archiveFilePath, metrics, 0); //此时获取的pkg也为null
if(pkg!=null){
Log.i("0410","pkg is not null");
}else{
Log.i("0410","pkg is null");
}

可是获取的pkg为null 请高手指点指点.....

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!