Sleep mode cancel or run in background


I would like to sketch an acceleration logger for human sleep application.
how can I cancel the “sleep mode” of iOS with openframework ?
Or can I make openframework application which run in background ?


I haven’t tried it, but I believe what you want is…

    [[UIApplication sharedApplication] setIdleTimerDisabled:YES];   

which I believe disables it going idle/sleep.

1 Like


I am not sure how to do with openframeworks.

but this code help to stop the sleep mode.

[UIApplication sharedApplication].idleTimerDisabled = YES;

if you know openframeworks function, pls let me know!

There’s no openframeworks specific function for this.

I believe you can just paste:

[[UIApplication sharedApplication] setIdleTimerDisabled:YES];   

in your setup() function. I haven’t tested myself, but I believe this should work.

1 Like

Yes this works as @cerupcat says, pasted in setup() in (or etc)