Android Utililty Methods APK Debuggable Check

List of utility methods to do APK Debuggable Check

Description

The list of methods to do APK Debuggable Check are organized into topic(s).

Method

booleanisDebuggable(Context context)
is Debuggable
PackageManager pm = context.getPackageManager();
try {
    ApplicationInfo info = pm.getApplicationInfo(
            context.getPackageName(), 0);
    return (info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
} catch (PackageManager.NameNotFoundException e) {
return true;
...
booleanisDebuggable(Context ctx)
is Debuggable
boolean debuggable = false;
X500Principal DEBUG_DN = new X500Principal(
        "CN=Android Debug,O=Android,C=US");
try {
    PackageInfo pinfo = ctx.getPackageManager().getPackageInfo(
            ctx.getPackageName(), PackageManager.GET_SIGNATURES);
    Signature signatures[] = pinfo.signatures;
    CertificateFactory cf = CertificateFactory.getInstance("X.509");
...