Traffic Event Broadcast
Event broadcasts include road events, navigation line events, vehicles ahead of the event, and surrounding event broadcasts.
Road Event Broadcastt
Speech the current road event. The sample code is as follows:
// initiate a request based on the road name // Set the request parameters RoadQuery roadQuery = RoadQuery.newQuery("Beijing-Tibet Expressway"); // Set the city roadQuery.setCity("BEIJING"); IncidentSearch.searchRoadIncident(roadQuery, new IncidentSearch.Listener() { @Override public void onSuccess(final IncidentResult result) { // Request success } @Override public void onFail(final APIStatus status) { //Request failed } });
RoadQuery Description:
1. RoadQuery.newQuery(String roadName) constructor, the parameter is the road name total i keyword, such as "Jingzang Expressway" or "Jingzang Expressway".
2. setCity(String city) sets the city, city is the full name of the city / abbreviation / national code pinyin (beijing), such as "Beijing" or "Beijing" or "beijing".
Note: The result return interface is an asynchronous thread interface.
Front Event Broadcast
Speech the road events in the front 45° sector. The sample code is as follows:
// Set the coordinate point set, for reference only GeoPoint[] geoPoints=new GeoPoint[]{ new GeoPoint(116.2305,40.07837), new GeoPoint(116.23058,40.07822), new GeoPoint(116.23069,40.07801) }; IncidentSearch.searchFrontIncident(FrontQuery.newQuery(geoPoints), new IncidentSearch.Listener() { @Override public void onSuccess(final IncidentResult result) { // request succeeded } @Override public void onFail(final APIStatus status) { // Request failed } });
FrontQuery Description:
1. FrontQuery.newQuery(GeoPoint[] geoPoints) constructor with parameters geoPoint coordinate set;
2. FrontQuery.newQuery(GeoPoint geoPoint, String direction), parameter explanation:
(1) geoPint: geoPoint coordinates.
(2) direction: direction, unit: degree, value range: [0-359], default: 0, true north is 0, counterclockwise direction is positive, ie: positive west is 90, south is 180, east Is 270.
Note: The result return interface is an asynchronous thread interface.
Nearby Event Broadcast
A voice broadcast of road events around the POI point. The sample code is as follows:
// Initiate a request based on the name of the poi point IncidentSearch.searchAroundIncident (AroundQuery.newQuery("NAVINFO NEW BUILDING"), new IncidentSearch.Listener() { @Override public void onSuccess(IncidentResult result) { // request succeeded } @Override public void onFail(APIStatus status) { // Request failed } });
AroundQuery Description:
1. AroundQuery.newQuery(GeoPoint geoPoints) constructor with parameters geoPoint coordinates;
2. AroundQuery.newQuery(String poiName), the parameter is the name of the POI point.
Note: The result return interface is an asynchronous thread interface.
Navigation Line Event Broadcast
Speech the route road event according to the trajectory latitude and longitude string. The sample code is as follows:
// Set the coordinate point set, for reference only GeoPoint[] geoPoints=new GeoPoint[]{new GeoPoint(116.2305,40.07837), new GeoPoint(116.23058,40.07822), new GeoPoint(116.23069,40.07801), new GeoPoint(116.23114,40.07706), new GeoPoint(116.23138,40.07662) }; // Initiate a request IncidentSearch.searchNaviIncident(NaviQuery.newQuery(geoPoints), new IncidentSearch.Listener() { @Override public void onSuccess(final IncidentResult result) { // request succeeded } @Override public void onFail(final APIStatus status) { // Request failed } });
Note: The result return interface is an asynchronous thread interface.