fix(mobile-app): 前台回来时也上传遥测队列(大厂标准做法)

进入前台时 flush 覆盖两种场景:
1. 上次 paused flush 因网络失败未上传的事件
2. 上次被强杀(force-kill)遗留在本地队列的事件

app_session_start 事件(含设备信息)也在此时立即上传,
无需等待10条阈值或30秒定时器。

参考:Amplitude/Mixpanel 均在 session start 时触发 flush。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-03-05 19:14:16 -08:00
parent 9e90294d0e
commit be415c1eb6
1 changed files with 4 additions and 0 deletions

View File

@ -87,6 +87,10 @@ class SessionManager with WidgetsBindingObserver {
_state = SessionState.foreground;
_startNewSession();
// + session_start
// Amplitude/Mixpanel
_telemetryService?.flushOnBackground();
}
///