I found this WWDC video which explains exactly what I needed to do to make my Intent an in-app Intent, and so far it seems to be behaving perfectly as I need...
https://developer.apple.com/videos/play/wwdc2020/10073/
Post
Replies
Boosts
Views
Activity
Thanks for your reply! I'm trying to enable a CLLocationManager with background tracking, amongst lots of other things (CoreData with iCloud etc), but it seems that when the location manager is started off from within the Intent, it doesn't then pick up the background location updates once the Intent has finished and exited. But the same code works when being used from the main app itself. It currently works if I make the Intent respond with a .continueInApp, because the app then starts up and it enables the location manager there and it does the background tracking. But I don't want it to bring the app to the foreground.
To give some background about the overall task I'm trying to achieve, I want to... be able to plug my iPhone into my CarPlay unit and it fire of a shortcut (which is possible with Shortcuts app) that then tells my own app to start tracking the route (i.e. locations). So I have an Intent in my app which is "start route recording" which stores some data (CoreData) to tell my app that a route is being recorded, and then a CLLocationManager is started up to accept background updates. It all works, just not from my Intent. If I enable the CLLocationManager from the Intent, it seems happy enough (no obvious errors) but it just doesn't seem to fire off the background updates and store the tracking data.
So how do I move my Intent code to my main app and have it fired off from the Shortcuts app?