Quantcast
Channel: maps for developers - Medium
Viewing all articles
Browse latest Browse all 2230

Introducing the Navigation SDK for Android

$
0
0

We’ve just released the Mapbox Navigation SDK for Android, making it easy to include a complete navigation experience from within your application. With the Navigation SDK, your users stay engaged and inside your application, all while they navigate to their destination.

Android phones showing day and night navigation sessions

The Mapbox Navigation SDK for Android is powered by our traffic-aware Directions API and it lets you control the experience from origin to destination.

Own the experience

The Navigation SDK comes out of the box with sensible defaults, but you can also personalize the entire experience. You can customize the timing of events, the threshold to trigger a re-route, or the way the traffic map looks like.

You can also select the location provider and its settings. The SDK uses the open source library LOST, which doesn’t depend on Google Play Services, to track the device’s GPS. However, you can swap this location provider with your own, including Play Services. This is useful to implement battery-friendly options, for devices with custom hardware, and to make sure your app can be available in any app store, in any country. It also makes testing much easier.

Android friendly

The API has been designed from scratch to be familiar to Android developers. For example, we use a Service to provide notifications when the app isn’t in the foreground, we build on top of AutoCompleteTextView to create the search widget, and we use Retrofit to power all HTTP requests (RxJava observables are supported!).

Along these lines, your app activity can simply implement a number of listeners to respond to common navigation events (AlertLevelChangeListener, NavigationEventListener, OffRouteListener, ProgressChangeListener). For example, to provide notifications while the user is traversing along the route you respond to the alerts provided by AlertLevelChangeListener:

navigation.addAlertLevelChangeListener(new AlertLevelChangeListener() {
  @Override
  public void onAlertLevelChange(int alertLevel, RouteProgress routeProgress) {
    switch (alertLevel) {
      case LOW_ALERT_LEVEL:
        // The user just completed the previous maneuver
        break;
      case HIGH_ALERT_LEVEL:
		 // The user’s about to do the next maneuver on the route
        break;
      case ARRIVE_ALERT_LEVEL:
        // The user has arrived
        break;
      ...
    }
  }
});

Getting started

To help you integrate the Navigation SDK into your app, we’ve published a new documentation section together with code samples.

Don’t forget to share what you are building and report back any bugs and feature request you might have through the GitHub repository. Be sure to checkout the latest updates to the iOS Navigation SDK (feature parity is one of our priorities). Show us on Twitter what you’re building when you embed the new Navigation SDK. We can’t wait to see it!


Viewing all articles
Browse latest Browse all 2230

Trending Articles