android-获得".apk"文件的相关信息。包名、版本号等等

    String filePath = "/sdcard/feijiedemo.apk";  
    PackageManager packageManager = getPackageManager();  
    PackageInfo packageInfo = packageManager.getPackageArchiveInfo(filePath, PackageManager.GET_ACTIVITIES);  
    Log.d("name", packageInfo.packageName);  
    Log.d("uid", packageInfo.sharedUserId);  
    Log.d("vname", packageInfo.versionName);  
    Log.d("code", packageInfo.versionCode+"");  
posted @ 2016-11-07 11:17  o卡卡西o  阅读(423)  评论(0编辑  收藏  举报