How to track screen view durations for a mobile app

I’d like to be able to view the total duration and average duration of each screen that is viewed within my mobile app.

I’m having trouble finding a solution since mobile apps in Bubble are single page apps and the url parameters never change.

I’m currently using the “Segment” plugin to track screen views based on when the button is clicked and using the action “track event with segment” instead of “send a page view”.

I’m thinking I can save the date/time as a custom state when a new screen is viewed, then when the users click to view a different screen, I’d save the time different between the custom states date/time and the current date/time (as seconds). Then save the screen view event and save the duration as a parameter in the segment event.

Is anyone aware of an analytics tools that can display this type of data? Preferably one thats easily integrated with segment.

Or is there a better solution to track / analyze screen view durations for mobile apps?

You could go with google analytics api: