Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; import android.content.pm.PackageManager; public class Main { public static String getAppPackageName(Context context) { String pkName = null; try { pkName = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).packageName; } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } return pkName; } }