HERE Android SDK Developer's Guide

Traffic Information

Traffic information can be displayed on the Map, depending on traffic data availability, by using Map.setTrafficInfoVisible(true) and setting the map to a traffic-enabled map scheme . Traffic visualization requires a network data connection to download real time traffic information. However, traffic information may continue to be displayed thereafter without a connection until the traffic events expire or the visibility is toggled.

The current traffic-enabled map schemes are:
  • Map.Scheme.HYBRID_TRAFFIC_DAY
  • Map.Scheme.HYBRID_TRAFFIC_NIGHT
  • Map.Scheme.NORMAL_TRAFFIC_DAY
  • Map.Scheme.NORMAL_TRAFFIC_NIGHT
  • Map.Scheme.CARNAV_TRAFFIC_DAY
  • Map.Scheme.CARNAV_TRAFFIC_NIGHT
  • Map.Scheme.CARNAV_TRAFFIC_HYBRID_DAY
  • Map.Scheme.CARNAV_TRAFFIC_HYBRID_NIGHT

The following figure shows a sample traffic visualization.

Figure 1. Traffic information with color-coded lines

Traffic flow lines are color coded as follows:

Green Normal
Amber High
Red Very High
Black Blocking

Traffic events are selectable through map gestures and OnGestureListener.onMapObjectsSelected(List<ViewObject>). A user selectable TrafficEventObject contains live traffic event information and is presented on the map in different forms. The following figures illustrate three examples:

Figure 2. TrafficEventObject example: Roadwork
Figure 3. TrafficEventObject example: Accident
Figure 4. TrafficEventObject example: Road Closed

To acquire information about a tapped TrafficEventObject (see MapObjects), use onMapObjectsSelected(List<ViewObject>) as in the following:


private MapGesture.OnGestureListener listener = new MapGesture.OnGestureListener() {
  ...
  @Override
  public boolean onMapObjectsSelected(List<ViewObject> objects) {
    for (ViewObject obj : objects) {
      if (obj.getBaseType() == ViewObject.Type.PROXY_OBJECT) {
        MapProxyObject proxyObj = (MapProxyObject) obj;
        if (proxyObj.getType() == MapProxyObject.Type.TRAFFIC_EVENT) {
          TrafficEventObject trafficEventObj =
                 (TrafficEventObject) proxyObj;
          TrafficEvent trafficEvent =
                  trafficEventObj.getTrafficEvent();
          Toast.makeText(getApplicationContext(), trafficEvent.getEventText(),
                  Toast.LENGTH_LONG).show();
        }
      }
    }

  return true;
};

You cannot use this account to purchase a commercial plan on Developer Portal, as it is already associated to plans with different payment methods.

To purchase a commercial plan on Developer Portal, please register for or sign in with a different HERE Account.

Something took longer than expected.

The project should be available soon under your projects page.

Sorry, our services are not available in this region.

Something seems to have gone wrong. Please try again later.

We've detected that your account is set to Australian Dollars (AUD).
Unfortunately, we do not offer checkouts in AUD anymore.
You can continue using your current plan as normal, but to subscribe to one of our new plans,
please register for a new HERE account or contact us for billing questions on selfservesupport@here.com.