Skip to content

Fly To Area

In this guide you will learn how to render an interactive map, search for a destination, and fly to the destination area.

Setup

First, get an API key token, see the Getting Started guide.

Download the Maps & Navigation SDK for Android archive file

Download the FlyToArea project archive file or clone the project with Git

See the Configure Android Example guide.

Run the example

In Android Studio, from the File menu, select Sync Project with Gradle Files

An android device should be connected via USB cable.
Press SHIFT+F10 to compile, install and run the example on the android device.

Android example screenshot

Android example screenshot

Android example screenshot

The example searches for the specified destination and flies to it.
If the destination has a perimeter, it is shown on the map.
Displays an interactive map which is fully 3D, supporting pan, pinch-zoom, rotate and tilt.

How it works

Android example screenshot

You can open the MainActivity.kt file and edit the search text as shown in the code block below, and run the app again to fly to a different area.

 1// Kotlin code
 2SdkInitHelper.onNetworkConnected = {
 3  // Defines an action that should be done after the network is connected.
 4  SdkCall.execute {
 5    val text = "Seattle" //"Paris" //"Amsterdam"
 6    val coordinates = Coordinates(0.0, 0.0)
 7    searchService.preferences.setSearchMapPOIs(true)
 8    searchService.searchByFilter(text, coordinates)
 9  }
10}

For example, you can change Seattle to Paris or Amsterdam in the text string and then run the example again.

Android Examples

Maps SDK for Android Examples can be downloaded or cloned with Git