is Apk Debugable - Android App

Android examples for App:APK Information

Description

is Apk Debugable

Demo Code


//package com.java2s;

import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;

public class Main {

    public static boolean isApkDebugable(Context context, String packageName) {
        try {/*from   w w w. j  a  va2  s .  com*/
            PackageInfo pkginfo = context.getPackageManager()
                    .getPackageInfo(packageName, 1);
            if (pkginfo != null) {
                ApplicationInfo info = pkginfo.applicationInfo;
                return (info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
            }

        } catch (Exception e) {

        }
        return false;
    }
}

Related Tutorials