is Apk Debugable - Android android.content.pm

Android examples for android.content.pm:Apk Property

Description

is Apk Debugable

Demo Code

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 {//  w  ww . ja  va 2 s . co  m
      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