Fly To Coordinates¶
Setup¶
First, get an API key token, see the Getting Started guide.
Download the Maps & Navigation SDK for Android archive fileDownload the FlyToCoordinates 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
How it works¶

You can open the MainActivity.kt file and edit the coordinates of the destination (latitude, longitude) as shown in the code below, and run the app again to fly to a different destination.
1// Kotlin code
2mapSurface.onScreenCreated = { screen ->
3 // Defines an action that should be done after the screen is created.
4 val coordinates = Coordinates(48.86141, 2.33420)//Musee du Louvre, Paris
5 flyTo(coordinates)
6}
For example, you can change the Coordinates
to (45.43597, 12.33060)
to fly to Venice instead, and then run the example again.
1private fun flyTo(coordinates: Coordinates)
2{
3 val animation = Animation()
4 animation.setType(EAnimation.AnimationLinear)
5 // Center the map on a specific set of coordinates using the provided animation.
6 mainMapView?.centerOnCoordinates(coordinates, -1, Xy(), animation)
7}
The mainMapView?.centerOnCoordinates(coordinates, -1, Xy(), animation)
function is used to fly to the specified coordinates.