Table of Contents

How to Record and Forward AR Session dump Files

AR Session dump files are the core basis for the EasyAR team to troubleshoot localization and tracking issues.

Before You Begin

What Is an AR Session dump File

Important

AR Session dump files are the most important basis for analyzing and solving Mega localization and tracking issues on WeChat mini programs.

An AR Session dump file records the key spatiotemporal context when the mini program sends a Mega localization request.

How to Record and Forward

Control the recording process by calling the session.dumpSession(signal: boolean) interface:

  • Pass in true: Start recording.
  • Pass in false: Stop recording and return the generated temporary file path (tempFilePath).

It is usually recommended to bind the recording logic to a UI button. When recording starts, use wx.showToast() to indicate that recording has started. When recording ends, use wx.shareFileMessage() to forward the recorded file through WeChat chat.

/**
 * 处理 Session 记录逻辑
 * @param signal true 为开始记录,false 为结束记录并转发
 */
dumpSession(signal: boolean): void {
  // 调用接口获取路径
  const recordPath = session.dumpSession(signal);
  // signal 为 true 时,接口返回空字符串,表示正在记录
  if (recordPath.length == 0) {
      wx.showToast({
          title: '开始记录数据',
          icon: 'success',
          duration: 2000
      });
      return;
  }
  // signal 为 false 时,处理返回的文件路径
  wx.shareFileMessage({
      filePath: recordPath,
      success() {
          wx.showToast({
              title: '记录转发成功',
              icon: 'success',
              duration: 2000
          });
      },
      fail() {
          wx.showToast({
              title: '记录转发失败',
              icon: 'error',
              duration: 2000
          });
      }
  })
}

This example demonstrates how to use session.dumpSession() in an xr-frame component to record and forward an AR Session dump file, and provides corresponding Toast prompts.


Note

Due to local storage limits of mini programs (usually 200 MB), it is recommended not to record for too long each time, and the maximum recording duration must not exceed 10 minutes.