Java tutorial
//package com.java2s; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import java.io.File; public class Main { public static String getApkFilePackage(Context context, File apkFile) { PackageManager pm = context.getPackageManager(); PackageInfo info = pm.getPackageArchiveInfo(apkFile.getPath(), PackageManager.GET_ACTIVITIES); if (info != null) { return info.applicationInfo.packageName; } return null; } }