Running in background / preventing auto-lock?
I apologize in advance - this is probably another basic question.
I'd like my python program to run continuously in the background until:
- it completes it's processing or
- I tell it to stop.
What tends to happen now is that (when it's working on a larger batch) the lock screen automatically kicks in after a couple of minutes and the script just dies. Is there an iOS-related command I can call (on a script-by-script basis) that would prevent it from doing this without having to disable 'Auto-Lock' manually in the iOS settings?
I noticed that some iOS games remain running (even after 5 minutes with no user input). This is what I'm trying to do. I'm not worried about draining the battery because the device is usually plugged in and charging and having that second screen to monitor while I work on something else would be really helpful.
Thank you again for Pythonista!
You can use
console.set_idle_timer_disabled(True)for this (set it to
Falseagain when you're done with your long-running activity).
Ok great - thank you!
When I add this line, the app kicks me back to the home screen every time and the program doesn’t start. Why is that?
@Snaresman, the link took me on a bit of a run-around, so here’s the workaround for the bug:
import console from objc_util import on_main_thread on_main_thread(console.set_idle_timer_disabled)(flag)
This post is deleted!last edited by Samuels