I'm working on Instrument cluster support for our CarPlay app. We already supported Dashboard and its working well.
On the CarPlay simulator I see my Instrument cluster ok, but on the real car - not.
I think, that were Apple Maps appear in Instrument Cluster - there and others app with Instrument Cluster support have to show, right?
On the same car I see that Apple Maps showing in Instrument Cluster, but not my app.
I've done everything from this video
<key>CPSupportsInstrumentClusterNavigationScene</key>
<true/>
and even
<key>UIApplicationSupportsMultipleScenes</key>
<true/>
What's else have to be done for showing my app in the Instrument Cluster?
Post
Replies
Boosts
Views
Activity
We have an app with CarPlay support. There you can preview a trip and start it.
However, if we start a trip (see eta and manoeuvres), then turn off the car (or tap disconnect in CarPlay Simulator), then turn it again - CarPlay launched, but there's no eta panel and manoeuvres in it. Even if cancel this trip and start new.
Only after relaunch the app eta and manoeuvres appear again.
Is someone experienced something similar? Maybe this is because some misunderstunding in CarPlay workflow?
I'm working on the app this has ability to monitoring user location even if app is suspended.
I'm experiment with geofencing feature of Core Location.
According to docs: https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/LocationAwarenessPG/CoreLocation/CoreLocation.html
At wake-up time, the app is put into the background and you are given a small amount of time (around 10 seconds) to manually restart location services and process the location data. (You must manually restart location services in the background before any pending location updates can be delivered It's said about Significant-change location service but I assumed that if they both (Region monitoring and Significant-change location) wake up app by UIApplicationLaunchOptionsKey.location key - behaviour must be similar.
But in reality I see that when app was woken up by this launch option - it's never (or at least very long time) get terminated.
My code is this:
import CoreLocation
import UserNotifications
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
var locationManagerForRegionMonitoring: CLLocationManager?
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool
{
if let launchOpt = launchOptions {
if launchOpt[.location] != nil {
showLocalNotification(with: "App awake")
locationManagerForRegionMonitoring = CLLocationManager()
locationManagerForRegionMonitoring!.delegate = self
locationManagerForRegionMonitoring!.requestAlwaysAuthorization() locationManagerForRegionMonitoring!.pausesLocationUpdatesAutomatically = true
}
}
registerNotifications()
return true
}
func addNewRegion(with coord: CLLocationCoordinate2D) {
let region = CLCircularRegion(center: coord,
radius: 50,
identifier: UUID().uuidString)
region.notifyOnEntry = false
region.notifyOnExit = true
locationManagerForRegionMonitoring?.startMonitoring(for: region)
}
}
extension AppDelegate: CLLocationManagerDelegate {
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
guard let location = locations.last else {
return
}
showLocalNotification(with: "Added new geofencing by current location: \(location)")
addNewRegion(with: location.coordinate)
}
func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {
showLocalNotification(with: "\(error.localizedDescription)")
}
func locationManager(_ manager: CLLocationManager, didExitRegion region: CLRegion) {
guard region is CLCircularRegion else { return }
let msg = "Exit the region. Remove this region. Requesting current location"
showLocalNotification(with: msg)
locationManagerForRegionMonitoring?.stopMonitoring(for: region)
locationManagerForRegionMonitoring?.requestLocation()
}
}
So I've added region monitoring for my current location, killed the app, and go for a walk.
As I expected after I exit the region - I got the notification App awake, then Exit the region. Remove this region. Requesting current location and after it - Added new geofencing by current location: {my location}.
But what I not expect - is that I never get the App awake notification again after 30 min of walking. Every ~ 2 minutes I've got:
Exit the region. Remove this region. Requesting current location
Added new geofencing by current location: {my location}.
So this means that app never get killed in background after it was launched initially (after first location event).
Why is that? Is I misunderstood something? Where I can read this in docs?