Was hoping to pick the brains of this group. This is purely a “for fun” project, definitely not anything I need. But I like playing w Shortcuts and we services.
I got access to a private API that allows me to query a global database where I can see what planes are in the air at any time. I can query by area, type, etc.
I was able to successfully create a Shortcut on my phone and run it, it returns JSON which I’ll have to figure out how to parse.
But here’s my minor dilemma. One thing I might like to do is say, “let me know when there’s a helicopter within 30 miles of this location.” Or maybe, “let me know anytime a U2 plane is in the air.”
This system doesn’t push out any alerts, you can only query it via the API. I suppose I could run the Shortcut every 10s, but I don’t think I can schedule things that way on iOS, no repeating tasks, only scheduled tasks? And even if I could I don’t think I want to either hammer the iPhone battery or the API that much.
Now if this was say Shortcuts worked on macOS, running on a Mac I leave up 24/7, then that would change things. I know I could write a traditional app or series of shell scripts on macOS now and do it but I don’t really want to. I want to play with Shortcuts.
[ @RosemaryOrchard I wonder if this or similar would be a good show topic? ]
So like I said I’m looking to pick people’s brains for some creative ideas to tinker with this some more. But I don’t want to create a Rube-Goldberg contraption either.
Interested in everyone’s thoughts. While the thing I’m working on is specific, I’m guessing the general problem of polling and scheduling is more general?
For anything where you need to poll a service you’re going to want a server. I would suggest it should use Pushcut to notify you when something meets the criteria you set out. What you could do is have a dedicated device running the Pushcut automation server, and it can run your shortcuts as often as you like (as well as on demand), and then send the notification to your other devices. It’s the easiest way to get what you want with the requirements you have.
The challenge with that approach is knowing the location of the target device rather than the server device for queries that include location parameters like “within 30 Miles”. As a workaround, you could conceivably save the client device location to a file in iCloud periodically, but there’ a potential for a large margin of error if travelling.
Thanks! I def need to read up more about about Pushcut Server. I played w the regular Pushut on my phone haven’t really gotten my head around the newer server component yet.
Thanks very much. I’m going to have to think about this some more. I’m not sure exactly where I’m going w this project yet.
@sliemeobn I’d love to get you in this discussion. Thoughts?
And something I’m not quite clear on. So Pushcut Server requires a second iOS device? I have an iPad Mini I’m guessing that will work? But what I’m not clear on is the second device, does it need to be awake? Could it be sitting with the lid closed and this still work? Thanks!
Pushcut Server is run from a dedicated device and the server has to be running in the foreground. This means having the screen on and the app visible; there is a screensaver that the server runs.
^ exactly ^
the whole thing is all about the “limitation” that you cannot just start foreground taks out of the background in iOS - and shortcuts can only be run “in the foreground” (at least for third-party apps).
that is why the Pushcut Automation Server needs to run - visibly on screen - to be able to process requests at any time.
once you have this, though, you have a ton of new options for your shortcuts: like run them every few minutes to check stuff, trigger them from background location triggers, or execute them via web-requests or IFTTT/Zapier, …
Ahhh, okay, thanks! I was trying to understand what running on another device buys you. Why not just run the entire thing on my phone in my pocket.
But you’re not trying to add functionality, you’re trying to get around the system limitation of the app needing to be running in the foreground.
Is it conceivable that once we get Shortcuts running on macOS, then we could do it there?
We’re so close to having a real cron-like scheduler on iOS.
Or if I had say an iPod Touch that ran iOS13 I could just leave it plugged-on and on all the time?
yep, sounds about right ; )
but I have never owned an iPod Touch, so I am not aware of any limitations this device might have…
Thx! I haven’t used one in a while either, and they may be a few revs behind the current iPhones w respect to hardware? But I’m guessing as long as it runs iOS13 it might be good. They’re more or less an iPhone without the Phone. Prob also doesn’t have NFC either.