Parassharmaa / usage_stats

Flutter Plugin to query Android Usage Statistics (Configurations, Events, Usage, Network)
MIT License
15 stars 19 forks source link

what is the unit of total time in foreground? #24

Open uzairshahzad082 opened 1 year ago

uzairshahzad082 commented 1 year ago

I am using this package to get the duration, an app remains in foreground, but it is returning a strange number which is entirely different.

Parassharmaa commented 1 year ago

It is measured in milliseconds.

https://developer.android.com/reference/android/app/usage/UsageStats#getTotalTimeInForeground()

uzairshahzad082 commented 1 year ago

Ok but it tells the total time the app uses, not just foreground. Because when I see it on Google Digital wellbeing and parental controls. It tells me correct screen time for each app. But when I check that from this package, it is much greater. Is there any solution?

ketan2jangid commented 2 months ago

I am also facing this. The 'totalTimeInForeground' method is returning time which is much greater than the actual time the app is used in the foreground, found this when I compared it with other apps.