code: public static boolean isDebuggable(Application app) {
          ApplicationInfo info = app.getApplicationInfo();
          return (info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
      }
docs: Checks if the application is running as debug mode or not.
  @param app the application to check
  @return true if debuggable, false otherwise.