Simulating routes on Android Emulator

Juna Salviati
Google for Developers Europe
3 min readMar 24, 2020
Photo by Immo Wegmann on Unsplash

It could be for a Java Android project, a Flutter app or a Kotlin app but sometimes you just need to simulate routes along a certain path (maybe to test a location based service).

Android emulator offers a simple way to simulate routes, even if it’s not so publicized: it is in fact possible to import GPX/KML files.

Building your own route

Google Earth makes it possible to build and export KML files to be imported in the emulator.

Open Google Earth and point a place you would like to start the trip from, let’s say “Piazza del Popolo”, in Rome. Click on the “Polyline” tool and trace your route on the map.

Press Enter to save the line.

Choose a title for the route, a title for the project and select “New KML file in the dropdown”. Click on “Save”.

The polyline will be automatically added to a new project. Click the three dot icon and choose “Export as KML file”.

Now you have a KML file to use in the emulator.

Simulating the route

Import the route in the emulator.

When you click on “Play route”, the location pointer will move along the route. You can try to open Google Maps in the emulator to verify that the route is being correctly emulated.

You can use Google Earth to compose more complex routes all around the city or…around the world, so have fun!

--

--