ScreenTrace API on Android is missing? #6247
Replies: 3 comments 6 replies
-
Hmmm 🤔 that's an interesting idea It's important to note that this is not an official API, this is a re-use of official APIs, in native code, to extend existing tracing to fragments. The existing screen trace functionality already automatically (unless disabled by config) collects this information, it's just at a different granularity (Activity, vs Fragment). This is a codelab (read as: programming exploration) to extend to fragment granularity. Does this even have applicability in a react-native app? I'm not sure it does as I'm not sure react-native uses fragments much if at all? I am not well informed in this area though, so that's my first question: does react-native use fragments at all? If not then there would be no point implementing this. If it does, then this could be useful. If you wanted to add it, you would need to add the custom ScreenTrace extension code and figure out how to install the fragment manager lifecycle callbacks in there somehow, in such a way that at best everyone just got it "for free" (no native code changes required) or at worst it was just a one-liner to add in MainActivity for those that wanted it. Ideally it would have a config param in firebase.json that turned it off though defaulting to on is probably what the majority would want This is not an official firebase API so I won't have time myself to directly implement it but I would collaborate with you on a PR if you wanted to contribute the code |
Beta Was this translation helpful? Give feedback.
-
Thank you! I have a question on architecture. Based on what I see there, to use it for fragments they just instantiate a screen trace and call .start on it. What's to stop us from just adding .start to the bridged methods and being able to use it in a useeffect, and then .end to end the custom trace? We can pass the string for the name across the bridge. Do we really actually need to try to instrument fragments or could we just use this ad hoc across the bridge? I noticed the screen trace needed the {this} as an input (context? fragment?), would that be our blocker? |
Beta Was this translation helpful? Give feedback.
-
This may be interesting: https://firebase.google.com/support/release-notes/android#performance_v20-1-0 |
Beta Was this translation helpful? Give feedback.
-
Android has an API for custom ScreenTraces: https://firebase.google.com/codelabs/measure-android-view-performance?hl=en#7. I noticed that react-native-firebase only has the regular (duration) trace API but not the ScreenTrace API. Would it be possible to add screentrace?
Beta Was this translation helpful? Give feedback.
All reactions