Open
Description
What feature would you like to see?
Many developers have moved from activities and fragments to compose. Compose usually has 1 activity, no fragments and internal navigation using composables. It would be great if we could track Composables (screens) performance and slow + frozen frames.
Something like this isn't working and won't show in the Screen rendering dashboard (it will send the trace and create a link, but it will be empty)
@Composable
fun LaunchTracing(route: String) {
val activity = LocalContext.current as Activity
DisposableEffect(key1 = route) {
val trace = Firebase.performance.newTrace(route).apply { start() }
val recorder = FrameMetricsRecorder(activity).apply { start() }
onDispose {
val metrics = recorder.stop()
if (metrics.isAvailable)
ScreenTraceUtil.addFrameCounters(trace, metrics.get())
trace.stop()
}
}
}
How would you use it?
We would be able to monitor performance on separate screens/components.