How to get the daily screen time?

I’m trying to get the daily screen time of the phone, but could not find much information on how to do it.

I found the link below, but don’t know how to implement that with ionic/capacitor.

There is also a npm package, but it seems abandoned.

Any Ideas?
Thanks a lot in advance.

So it appears that the screen time API does not report usage, only letting you set limits.

The UsageStatsManager should contain something like screen time, or at least with the information provided there it should be possible to calculate it.

I also asked on stackoverflow, and I got an answer that it’s possible to create own capacitor plugins: Creating Capacitor Plugins | Capacitor Documentation
That would need some Java/ Kotlin coding, which I did not do before, but at least it’s a possibility.