Determine if user is active or idle in Camera or File Picker

I’m working on a project where automatic logout is a necessity. The mechanism for detecting user activity is all implemented in Typescript, and is based on event listeners and redux actions. However, I’m not sure how I can determine if the user is active when interacting with a native interface. Any ideas how I could achieve this?

I don’t think there are any iOS or Android APIs for detecting inactivity. You can detect when the screen is locked but it might not make sense to do that since users can set their own time to inactivity. This might be something that’s better to do on the web side like you already are