Android examples for Android OS:System Model
is Debug Mode
//package com.java2s; import android.app.Activity; import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; public class Main { public static boolean isDebugMode(Activity context) { boolean debug = false; PackageInfo packageInfo = null;// ww w .j a va2 s . c o m try { packageInfo = context.getPackageManager().getPackageInfo( context.getApplication().getPackageName(), PackageManager.GET_CONFIGURATIONS); } catch (NameNotFoundException e) { e.printStackTrace(); } if (packageInfo != null) { int flags = packageInfo.applicationInfo.flags; if ((flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { debug = true; } else { debug = false; } } return debug; } }