Disabling screen saver

Saturday, January 28 2006 @ 10:45 AM UTC

Contributed by: cocoa

How to simulate user activity so that screen saver or energy saver doen't stop a length background task without user activity ?

#import


- (void)awakeFromNib
{
    fTimer = [NSTimer scheduledTimerWithTimeInterval:30
            target:self
            selector:@selector(dummyActivityTimer:)
            userInfo:nil
            repeats:YES];
    ...
}

- (void) dummyActivityTimer:(NSTimer *)timer
{
    OSErr err = UpdateSystemActivity(UsrActivity); // in Power.h

    ...
}

0 comments



http://www.macosxguru.net/article.php?story=2006012810453520