firebase / firebase/firebase-android-sdk
Performance screen rendering is supported only for activities and fragments - compose support
- Dominant language
- Java
- Stars
- 2.6k
- Forks
- 710
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 31
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.
Contributor guide
Assessment
This issue has not been assessed yet.