I want to measure the time of a task in my app using firebase performance traces; however, I don't want to include time when the user backgrounds the app. I can't find a way to cancel the task if the task is no longer needed.
For example
How do I ensure that the time the app was backgrounded doesn't affect my metrics? I would assume throwing out those samples would work but there is no cancel method.
If you don't want a trace to be reported, simply don't call stop()
on it. A Trace doesn't actively do anything at all until you do call stop()
.