Android examples for App:APK Information
get Apk Package Name
//package com.java2s; import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; public class Main { public static String getApkPackageName(Context context, String apkPath) { if (context == null || apkPath == null) { return null; }/*from w w w.j a v a 2 s .co m*/ PackageManager pm = context.getPackageManager(); PackageInfo info = pm.getPackageArchiveInfo(apkPath, PackageManager.GET_ACTIVITIES); if (info != null) { ApplicationInfo appInfo = info.applicationInfo; String appName = pm.getApplicationLabel(appInfo).toString(); String packageName = appInfo.packageName; //????????? return packageName; } return null; } }