firebase / firebase/firebase-android-sdk
Customizable screen name in Firebase Performance metrics
- Dominant language
- Java
- Stars
- 2.6k
- Forks
- 710
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 34
Description
## What 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
Contributor guide
Assessment
This issue has not been assessed yet.