tencent cloud

문서Tencent Cloud Observability Platform

API Description

Download
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-05-25 18:01:56
AI 번역
This article describes the feature APIs of the Terminal Performance Monitoring Pro (RUM Pro) SDK to facilitate flexible and in-depth integration.

Adding a Page Switching Behavior

You can add page switching behavior based on the framework you use. Rum Pro stores up to 256 records. They are automatically reported when an error occurs. You can view them in Context Data > Page Tracking.
Bugly.addPageAction('pageAction');

Lifecycle Listening

Set up BuglyNavigatorObserver in the app.
class _MyAppState extends State<MyApp> with WidgetsBindingObserver {


@override
void initState() {
super.initState();
}


@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('APM Example'),
),
body: Center(
child: MyHome(),
),
),
// Adds BuglyNavigatorObserver.
navigatorObservers: [BuglyNavigatorObserver()],
routes: {
'MainPage': (context) => MainPage(),
'FirstPage': (context) => FirstPage(),
'SecondPage': (context) => SecondPage(),
},
);
}
}

If you have integrated a hybrid stack framework such as TRouter that takes over the native Navigator, you need to add BuglyNavigatorObserver to the hybrid stack framework, as shown below.
runApp(MaterialApp(
home: TRouteContainer(navigatorObservers: BuglyNavigatorObserver(),),
));

Note:
TRouter version 2.5.7 or later is required; otherwise, some lifecycle events may be lost.

Configuring Launch Monitoring Instrumentation

To track launch performance, you need to set instrumentation points when opening Flutter pages from native code.
Android:
Intent intent = new Intent(MainActivity.this, TestFlutterActivity.class);
MainActivity.this.startActivity(intent);
FlutterLaunchMonitor.onEnterFlutter();
iOS:
[[TFlutterLaunchMonitor sharedInstance] onEnterFlutter];

Setting the User ID

If your app cannot set the user ID during SDK initialization, you can call Bugly#setUserId to set it.
Bugly.setUserId('your_user_id');

Setting Log

By default, internal SDK logs are printed using print and are not persisted. You can redirect logs to your custom logging system by setting BuglyOptions.logger.
BuglyOptions.logger = MyLogger



도움말 및 지원

문제 해결에 도움이 되었나요?

피드백