Example usage for android.content.pm ApplicationInfo FLAG_DEBUGGABLE

List of usage examples for android.content.pm ApplicationInfo FLAG_DEBUGGABLE

Introduction

In this page you can find the example usage for android.content.pm ApplicationInfo FLAG_DEBUGGABLE.

Prototype

int FLAG_DEBUGGABLE

To view the source code for android.content.pm ApplicationInfo FLAG_DEBUGGABLE.

Click Source Link

Document

Value for #flags : set to true if this application would like to allow debugging of its code, even when installed on a non-development system.

Usage

From source file:Main.java

/** Check if the app can be debugged or not */
public static boolean isDebugable(Context context) {
    if (isDebuggable == null) {
        if (context == null) {
            throw new NullPointerException("Context should not be null the first time.");
        }//from w w w .j av  a  2 s . c o m
        isDebuggable = (0 != (context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE));
    }
    return isDebuggable;
}

From source file:Main.java

public static boolean isDebuggableApp(Context context) {
    int flags;/*from   w  w w . j a  va  2 s.c om*/
    try {
        flags = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).applicationInfo.flags;
    } catch (NameNotFoundException e) {
        flags = 0;
        e.printStackTrace();
    }

    boolean isDebuggableApp = ((flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0);
    return isDebuggableApp;
}

From source file:Main.java

public static boolean isApkDebuggable(Application application) {
    PackageManager pm = application.getPackageManager();
    try {/*from w w w .j  a  v  a2s .  co m*/
        return ((pm.getApplicationInfo(application.getPackageName(), 0).flags
                & ApplicationInfo.FLAG_DEBUGGABLE) > 0);
    } catch (NameNotFoundException e) {
        return false;
    }
}

From source file:Main.java

public static boolean isDebug(Context context) {
    boolean ret = false;
    if (context == null)
        return false;
    PackageManager manager = context.getPackageManager();
    try {//from  w w  w.j  ava  2  s.c om
        PackageInfo info = manager.getPackageInfo(context.getPackageName(), 0);
        int flag = info.applicationInfo.flags;
        if ((flag & ApplicationInfo.FLAG_DEBUGGABLE) == ApplicationInfo.FLAG_DEBUGGABLE) {
            ret = true;
        }
    } catch (NameNotFoundException e) {
        // TODO Auto-generated catch block
        Log.e("WxException", e.getMessage(), e);
    } catch (Throwable e) {
        // TODO: handle exception
        return false;
    }
    return ret;
}

From source file:Main.java

public static boolean isDebuggable(Context context) {
    PackageManager pacMan = context.getPackageManager();
    String pacName = context.getPackageName();
    ApplicationInfo appInfo = null;//from   w w w .  j  av a2  s .  c o m
    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;
    }

}

From source file:Main.java

/**
 * @return true if the app is debuggable, false otherwise
 *///from w  w w.j av a  2 s. com
public static boolean isDebuggable(Context context) {
    return ((context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0);
}

From source file:Main.java

public static boolean isDebugVersion(Context ctx) {
    int flags = ctx.getApplicationInfo().flags;
    if ((flags &= ApplicationInfo.FLAG_DEBUGGABLE) != 0) {

        return true;
    } else {// w ww.  jav a 2  s  .c o  m
        return false;
    }
}

From source file:Main.java

public static boolean isDebug(Context ctx) {

    boolean isDebuggable;
    isDebuggable = (0 != (ctx.getApplicationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE));
    // System.out.println( "isDebug : " + isDebuggable);
    return isDebuggable;
}

From source file:Main.java

/**
 * Judge whether an app is dubuggable/*from w w  w  .  jav  a  2  s . c  o  m*/
 *
 * @param context
 * @return
 */
public static boolean isApkDebuggable(Context context) {
    try {
        ApplicationInfo info = context.getApplicationInfo();
        return (info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
    } catch (Exception e) {

    }
    return false;
}

From source file:Main.java

public static boolean isDebuggable(Context context) {
    return (0 != (context.getApplicationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE));
}