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

public static boolean isApkDebugable(Context context) {
    try {//from w  w  w  .jav a2 s .c om
        ApplicationInfo info = context.getApplicationInfo();
        return (info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
    } catch (Exception e) {

    }
    return false;
}

From source file:Main.java

public static void setIsDeBug(Context context) {
    ApplicationInfo applicationInfo = context.getApplicationInfo();
    try {//from  w  w w.j av a2 s. co m
        isDebug = ((applicationInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0);
    } catch (Exception e) {
        isDebug = false;
        e.printStackTrace();
    }
}

From source file:Main.java

public static boolean isApkInDebug(Context context) {
    try {/*from  www .  java  2 s  . c om*/
        ApplicationInfo info = context.getApplicationInfo();
        return (info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
    } catch (Exception e) {
        return false;
    }
}

From source file:Main.java

public static boolean isDebug(Context context) {
    if (sIsDebug == null && context != null) {
        final ApplicationInfo info = context.getApplicationInfo();
        if (info != null)
            sIsDebug = (info.flags &= ApplicationInfo.FLAG_DEBUGGABLE) != 0;
    }//w  w  w.j a  v  a2 s  . c  o  m

    return sIsDebug != null && sIsDebug;
}

From source file:Main.java

public static void debugMode(Context context) {
    if (isDebug == null) {
        isDebug = context.getApplicationInfo() != null
                && (context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
    }/*from ww w.  ja  v  a 2s  .c o m*/
}

From source file:Main.java

/**
 * Check if android:debuggable is true // ww w. ja v a2s. c  o m
 * @param context
 * @return
 */
public static boolean isDebuggable(Context context) {
    ApplicationInfo ai = context.getApplicationInfo();
    if (ai == null) {
        return false;
    }
    return (ai.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
}

From source file:Main.java

public static void DEBUG(Context c) {
    try {//from  www  .  ja  va2  s .c om
        debug = (c.getPackageManager().getApplicationInfo(c.getPackageName(), 0).flags
                & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
    } catch (NameNotFoundException e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static boolean isDebuggable(Context context) {
    PackageManager pm = context.getPackageManager();
    try {/*from  w w  w .  j ava 2s.com*/
        ApplicationInfo info = pm.getApplicationInfo(context.getPackageName(), 0);
        return (info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
    } catch (PackageManager.NameNotFoundException e) {
    }

    return true;
}

From source file:Main.java

/**
 * <pre>/*  www .ja v  a 2 s . c  o m*/
 * Check if android:debuggable is set to true
 * </pre>
 */
public static boolean getAppFlagDebug() {
    ApplicationInfo appInfo = getCurrentContext().getApplicationInfo();
    int appFlags = appInfo.flags;
    boolean b = (appFlags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
    return b;
}

From source file:Main.java

/**
 * Sync lib debug with app's debug value. Should be called in module Application.
 *
 * @param context/*from   w  w  w  .j a  v  a2 s  .  co m*/
 */
public static void syncIsDebug(Context context) {
    if (isDebug == null) {
        isDebug = context.getApplicationInfo() != null
                && (context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
    }
}