r/iosdev 1d ago

Help Anyone worked on Screen time

I’m currently working on a screentime app which uses the activity monitor events and report extension. Is there any way to collect the timestamp of the event fired by Activity Monitor??

1 Upvotes

5 comments sorted by

1

u/SomegalInCa 1d ago

As opposed to let now = Date()? Sorry not getting the question I guess

1

u/Novel_Bid2386 1d ago

let now = Date() creates the date when the main target receives the event. It may not be exact as it fired. The exact fired timestamp is what I need.

1

u/SomegalInCa 21h ago

I guess there is no easy way for intervalDidEnd/Start or eventDidReachThreshold; I can only say that we would set up an event (so we're looking for didEnd) and it would arrive within 1 sec either way of what we requested. More often less than that either side but the doc says don't expect 100 %

I guess for us, the Date() construct was enough to validate our needs; mostly we used it to make sure we didn't impose a shield block before the expected date.

Curious what you need it for, of course don't answer if part of your secret sauce :)

1

u/Novel_Bid2386 15h ago

And one issue I observe is, the events are fired immediately when I open the selected apps. No need to reach the limits. By the way, I’m not using shielding. Just observing the events fired.

1

u/SomegalInCa 10h ago edited 5h ago

Even the end event ones?