Customizable screen name in Firebase Performance metrics
See original GitHub issueWhat feature would you like to see?
When using Firebase Performance in my app, I see we have all screens tracked under the same screen name, making it unusuable since it aggregates all screens together. This is happening since I have a parent activity that dynamically starts new fragments with the appropriate content. Note that this is not identical to a classic single activity project, since in my case we do open multiple activities, but the activity class name is always the same. Checking the code I think the info from the screen name comes from here:
// AppStateMonitor
public static String getScreenTraceName(Activity activity) {
return "_st_" + activity.getClass().getSimpleName();
}
Could you provide an API to instead of always getting the name from the class, to allow for custom namings? this way I would just add my own logic to show a custom screen name, and so I can distinguish the different screens with their appropriate frame metrics.
How would you use it?
I would like to be able to setup something during my app startup like:
AppStateMonitor.getInstance().setScreenNameProvider { activity -> activity.myFragmentLogic.name }
This provider by default could be instantiated with the current logic to be backward compatible:
val screenNameProvider = { activity -> activity.getClass().getSimpleName() }
An alternative approach to the lambda could be providing some interface that the activity can implement to provide the name
Issue Analytics
- State:
- Created a year ago
- Comments:7 (3 by maintainers)
Thanks @thatfiredev ! I am giving it a try and seems to work like a charm. I will put in on pro next week. I will let you know if any issue arises. Regards!
I think we still need the custom screen name for react native and would need to be able to disable the Fragment workflow. See #3756