eventDidReachThreshold triggered while target app is in background

Hello!

I am using the eventDidReachThreshold callback in the DeviceActivityMonitor in order to shield a target app after the user has spend x amount of time on it (e.g. x = 5 minutes).

Many times this works fine, and I can trigger my shield after the specified threshold has been met.

However sometimes, when they leave the target app before the threshold has been reached, the eventDidReachThreshold callback gets called randomly while they are doing something else on their phone (e.g. using a different app, on the Home Screen, phone locked…).

From my perspective this does not make sense, since they are not actively spending time on the target app, and that time should not be counted towards the target app’s threshold.

And it is also very confusing for the users because they will then find a blocked target app even though they haven’t used their time budget completely.

This is not related to the intervalDidStart / intervalDidEnd callbacks, because they are not correlating with the timing of when the eventDidReachThreshold callback is called unexpectedly.

Any ideas what this could be related to?

eventDidReachThreshold triggered while target app is in background
 
 
Q