We're developing a Health app where we would like to track the Screen Time of the user to display relevant correlations with other health and lifestyle data.
Using the Device Activity API we're able to subscribe to events when a user reaches certain thresholds, so to track this we've set up events every x minutes to be able to track progress during the day, like this:
user_reached_5_minutes
user_reached_10_minutes
and so on..
This works fine and is stable (as long as it works). But I suspect we're running into some kind of rate limiting issue since it stops working during the day, and after that it seems to need a new day for it to start working again. Worth noting is that our monitoring interval is repeating daily, so that might very well be related.
I've not been able to find any documentation on this, and no error messages indicating we're running into a limit in the logs. The only related thing I've seen is this - but it seems to suggest this should fail when calling startMonitoring and not silently fail like we're experiencing:
Attempting to monitor too many activities or activities that are too tightly scheduled can cause this method to throw an error.
The system throws an error if the attempt to monitor the device activity failed. To avoid errors, reduce the number of unique, tightly-scheduled activities. For example, consider using the warningTime property of an activity’s schedule.
Does anyone have an idea of what is going on here?