Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; public class Main { public static boolean isDebuggable(Context context) { PackageManager pacMan = context.getPackageManager(); String pacName = context.getPackageName(); ApplicationInfo appInfo = null; try { appInfo = pacMan.getApplicationInfo(pacName, 0); } catch (NameNotFoundException e) { e.printStackTrace(); } if (appInfo != null) { if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { return true; } else { return false; } } else { return false; } } }