Can you find individual app usage duration using S

2019-05-24 07:54发布

问题:

I have a background service running on iOS5. I am trying to find the duration for which each foreground application runs. I came across this great post by Vikarti Anatra. how to determine which apps are background and which app is foreground on iOS by application id

This shows how to get the current foreground process. However, what I would like to know is if there is a method which will give me the start time of various processes launched by Springboard so I can compute the duration.

I am trying to create a log of apps launched by my users. This is not meant for app store certification and meant to be an internal organization tool.

Thanks.

回答1:

Have you had a look at SBApplication? Perhaps you could swizzle -[SBApplication activate] and -[SBApplication deactivate] inside SpringBoard.app and calculate the time between them?