startSendingUpdates(for:to:)
Starts the delivery of regular power level updates for a particular electric vehicle.
Declaration
optional func startSendingUpdates(for intent: INGetCarPowerLevelStatusIntent, to observer: any INGetCarPowerLevelStatusIntentResponseObserver)Parameters
- intent:
The intent object that indicates which electric vehicle you need to provide updates for. The Vocabularyidentifier property of the Carname speakable string stores the unique Caridentifier.
- observer:
The observer you send the updates to. You must store a reference to this object and call its Didupdate(getcarpowerlevelstatus:) method when you have a power level update to deliver. For more information, see Ingetcarpowerlevelstatusintentresponseobserver.
Discussion
Maps calls this method when it begins a navigation session, and you must use the observer to inform Maps of any abrupt changes in the electric vehicle’s battery charge. Store a reference to the observer, and continue providing updates until the system calls stopSendingUpdates(for:).
To determine which vehicle you need to send updates for, you can extract the vehicle’s unique indentifer from the vocabularyIdentifier property of the intent’s carName speakable string. This is the same value as the carIdentifier in the vehicle’s corresponding INCar object that your INListCarsIntentHandling handler returns.