How do I track usage time of my app?

I want to track the usage time of my own app. How can I do that?

This may work for you,

image

You might also search for an extension that monitors the life cycle of the app, to start/stop the counter when your app goes into the background.

That depends, because my apps are used in the background most of the time. And I would also like to record this duration of use. Since most of my apps are audio apps, I track app usage time using the Payer.IsPlaying method.

True :blush:

Can you suggest one extension?

If you want to count cumulative seconds usage, devote a Clock component to usage tracking, and a TinyDB tag to cumulative runtime seconds, default 0.

In your UsageClock Timer event (always running, 1 per second),
save TinyDB Tag 'cumulativeSeconds' to 1 + (TinyDB.GetValue( 'cumulativeSeconds', default 0)

This isn't working

What is not working? What have you tried? Show your blocks.