@Override
    protected Face[] doInBackground(InputStream... params) {
      FaceServiceClient faceServiceClient = SampleApp.getFaceServiceClient();
      try {
        publishProgress("Detecting...");

        // Start detection.
        return faceServiceClient.detect(
            params[0], /* input stream of image to detect */
            false, /* whether to analyzes facial landmarks */ false, /* whether to analyzes age */
            false, /* whether to analyzes gender */ false); /* whether to analyzes head pose */
      } catch (Exception e) {
        mSucceed = false;
        publishProgress(e.getMessage());
        addLog(e.getMessage());
        return null;
      }
    }