Time Events or Background Wait? (Will Decide to Buy Accordingly)
I have a project that should run at a given time.
Ideally, this would be done with events, but I haven't seen such even in the docs. For example:
@event def on_clock(13, 40):
Or with waiting, though I assume it'd use more battery resources, and has to be able to wait in the background. For example:
given_time - current_time = left_time wait(left time)
Is there such thing in Pythonista? If there is, I'd be the happiest and would definitely buy it, if not though, unfortunately, I'll have to look further on how I could do this.
Thanks in advance, have a nice day.
@wentaas, I do not think there is anything like your first option, and the wait method will not be reliable with iOS shutting down background processes at will.
Would notifications work for your use case?
First of all, thank you for your reply, and I apologise for my late answer.
I'm not sure what you mean by notifications, but I want my program to turn Do Not Disturb on at the given time and turn it off at another given time.
It is possible with XCode, or that would be the most indelicate that I'd have to do it for Android since my Android phone is far from ideal to test.
Speaking of which, would it be easier than XCode were I to do it on Android?
@wentaas, since start and end times for Do Not Disturb can already be managed in iPhone settings, you must be looking for something else. Can you elaborate?
JonB last edited by
do not disturb cannot be set programatically with xcode... ios is very tight about these sort of things. while you can run things in the background in pythonista, you limited to something like 10 minutes after you switch away from the app.
You can set notifcations, with attached scripts -- and you get an alarm/notifcation on your device, but then you have to hit Open to launch the app/script
I will add the ability of setting more than one time period.
That is so sad, should I switch to Android, would Android be easier, and would the fact that my Android phone is really bad matter?
If so, do I have to use Android Jetpack or Android Studio, or can I use Shortcut-like apps for Android?
Also, thank you for both of your replies.
@wentaas, ok, so it seems that the best you could do with Pythonista, and iOS in general, is to get a notification at set times, where you would then need to click OK to launch Pythonista, which would then launch a Shortcut to toggle the Do Not Disturb mode.
In general, this is not the best forum to ask about Android development.
... and you do not even need Pythonista for it. Just create a Shortcut to e.g. turn Do Not Disturb off, then say to Siri ”Remind me of this every day at seven am”, and repeat for the other times. Not what you wanted, but probably the best we have on iOS today.
I see. Thank you for your help. I have done it with MacroDroid, but since I need a Google Play or App Store app, or at least an APK or PIA file ready to be uploaded to the store, I think I’ll have to use Android.
One last question, is it possible to automatically run a shortcut at a given time? I guess no, it can’t unlock your phone.
I’d be surprised if they didn’t let an app toggle DND but let it open an app, let alone unlocking the phone.
Anyway, thank you for your help again. Have a nice day.
cvp last edited by
If @omz decides to support silent notifications we could have this kind of feature, with a server sending a remote silent notification received by Pythonista app even in background, without any user intervention.
Note that Pythonista doc also speaks about silent notifications but meaning local notifications without sound. That's really completely different.