Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to track frame metrics for Fragments with Firebase performance?

Firebase Performance monitoring SDK for Android automatically tracks slow rendering and frozen frames for Activity. But there's no such data for Fragment. For example if activity A hosts 3 fragments, then it'll report slow rendering and frozen frames for activity A but there's no way of knowing which fragment is causing that. Is there a way to implement similar screen tracing for fragments?

like image 866
Mehedi Avatar asked Jan 17 '20 07:01

Mehedi


People also ask

How does firebase performance monitoring work?

After you've added the Performance Monitoring SDK, Firebase automatically starts collecting data for your app's screen rendering and data related to your app's lifecycle (like app start time). To enable Firebase to monitor network requests, you must also add the Performance Monitoring Gradle plugin (next step).

Is firebase performance monitoring free?

Firebase Performance Monitoring is a free and cross-platform service to help you collect and analyze RUM data for your app or website. Firebase Performance Monitoring automatically measures common metrics like time to first paint and HTTP request performance.

What is frozen frame firebase?

Frozen frames — Measures the percentage of screen instances that take longer than 700ms to render.

What is firebase performance?

Firebase Performance Monitoring is a service that helps you to gain insight into the performance characteristics of your Apple, Android, and web apps. You use the Performance Monitoring SDK to collect performance data from your app, then review and analyze that data in the Firebase console.


1 Answers

This is correct that Firebase performance SDK doesn't capture frozen frames automatically(For Fragments) but we can do it manually. Refer to this doc by google: https://firebase.google.com/codelabs/measure-android-view-performance#7

And this ScreenTrace class: https://github.com/FirebaseExtended/codelab-measure-android-view-performance/blob/main/measure-view-performance-start/app/src/main/java/com/google/firebase/example/perfmon/ScreenTrace.java

Now we can use activity's fragment manager to start recording the trace or inside the Application class we can add the fragment lifecycle callback and start the record trace inside onAttach()

like image 99
Dikshant Manocha Avatar answered Sep 28 '22 11:09

Dikshant Manocha