Sleep mode cancel or run in background

hello,

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 ?

best,
Naoya

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

hello.

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 testApp.mm 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 ofApp.mm (or testApp.mm etc)