예제 #1
0
  /**
   * Start the listening service, providing a custom initializer as per {@link
   * #newInitializerBuilder}.
   *
   * @see #initializeWithDefaults(Context)
   */
  public static void initialize(final Initializer initializer) {
    // Hook activity tracking so that after Stetho is attached we can figure out what
    // activities are present.
    boolean isTrackingActivities =
        ActivityTracker.get()
            .beginTrackingIfPossible((Application) initializer.mContext.getApplicationContext());
    if (!isTrackingActivities) {
      LogUtil.w(
          "Automatic activity tracking not available on this API level, caller must invoke "
              + "ActivityTracker methods manually!");
    }

    Thread listener =
        new Thread(LISTENER_THREAD_NAME) {
          @Override
          public void run() {
            LocalSocketHttpServer server = new LocalSocketHttpServer(initializer);
            try {
              server.run();
            } catch (IOException e) {
              LogUtil.e(e, "Could not start Stetho");
            }
          }
        };
    listener.start();
  }
예제 #2
0
파일: Stetho.java 프로젝트: kaedelin/stetho
  /**
   * Start the listening service, providing a custom initializer as per {@link
   * #newInitializerBuilder}.
   *
   * @see #initializeWithDefaults(Context)
   */
  public static void initialize(final Initializer initializer) {
    // Hook activity tracking so that after Stetho is attached we can figure out what
    // activities are present.
    boolean isTrackingActivities =
        ActivityTracker.get()
            .beginTrackingIfPossible((Application) initializer.mContext.getApplicationContext());
    if (!isTrackingActivities) {
      LogUtil.w(
          "Automatic activity tracking not available on this API level, caller must invoke "
              + "ActivityTracker methods manually!");
    }

    initializer.start();
  }