You are here

How To Mobilize and Sync Google Maps Data With Firebase

Logging your location is a useful tool for keeping track of location details. For example, if you run a food blog and decided to travel to an exotic destination to sample a few delicacies, logging your location where you eat each meal would provide readers with valuable information on where the event took place that written directions simply couldn’t achieve.

The technology works by tracking latitude and longitude information at each instance, often with a timestamp included, and storing that information for future referencing against map data. In this tutorial on the Google Geo Developers Blog, author Dong Sun is using location logging to track their progress across the country. This is the second post of the Code the Road series of tutorials for building a road trip app that will help the team stay connected while on the road.

For real-time features, the author uses Firebase, which is a NoSQL mobile app platform that is able to sync data across devices for online and offline access via mobile applications. Firebase is also capable of handling User Authentication.

Beginning by referencing the series’ first post for creating a new project in Android Studio and obtaining a Google Maps API key, this post begins with setting up Firebase to capture and save locations. This includes getting the initial device location as well as creating a location request and defining an update interval depending on your particular use-case.

The third and final step involves retrieving the data from Firebase and drawing it on the map as a marker, with an added Index Rule for improving query performance. Code examples are provided, along with reference links for the classes used throughout.

Be sure to read the next Location article: Getting Started with LocationKit for iOS and Android

Original Article

Code the Road Android App: Store your location data in the cloud with Firebase