here-sdk-examples
here-sdk-examples copied to clipboard
Android, Navigate Edition: Traffic incidents on route
We use the Navigate SDK for Android, version 4.18.5.0.
We want to notify the user about traffic incidents on the route and display them on the map.
First we call Section.getTrafficIncidents() to retrieve a list of incidents. 'TrafficIncidentOnRoute' provides some properties of the incident, but not its location.
To resolve the location we try to match the incident by ID with the incidents retrieved from the 'TrafficEngine'. Unfortunaly we can only query within a rather tiny radius (or box, or corridor) or an error will occur: 'TrafficQueryError: INVALID_GEOMETRY'.
How should we proceed to obtain the incidents and their locations on a route longer than a couple of kilometers?