开发者

Does anyone know of a Cocoa/Obj-C library that can be used to gather application usage data

I would like to be able to gather info like how often certain windows are opened, what types of user data are accessed, how often menu items are clicked, etc. Does anyone know of a 3r开发者_开发技巧d party (open source or commercial) Cocoa/Obj-C library or plugin that would allow me to gather this info?


I have used pinch media in the past, and they merged with Flurry. Library was simple to use and was setup in around 40 minutes.


I don't know any library for that but at least to get informed about when the user switches the front application you can install an event handler like this:

EventTypeSpec eventType;
eventType.eventClass = kEventClassApplication;
eventType.eventKind  = kEventAppFrontSwitched;
EventHandlerUPP handlerUPP = NewEventHandlerUPP(FrontAppSwitchedDetector_callback);
OSStatus status=InstallApplicationEventHandler(handlerUPP,1,&eventType,self,&_eventHandlerRef);

... and when receiving an callback you may get the current front application process:

pascal OSStatus FrontAppSwitchedDetector_callback(EventHandlerCallRef nextHandler,EventRef theEvent,void* userData)
{
    ProcessSerialNumber newSerial;
    GetFrontProcess(&newSerial);
    //to something with that ....
    return (CallNextEventHandler(nextHandler, theEvent));
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜