This video shows the steps to setup the location listener in your App’s java code. It uses Google Maps API Key to get the google maps in your App. It registers the location listener using the location manager which uses the phone’s system service to get location service. This location service is responsible to get the current location of the device/ phone and display it on the edit text boxes – latitude and longitude respectively. It uses both GPS and NETWORK information to get the precise coordinates of the location.
Then it gives an Update button which is responsible to update the location information to the Firebase database. How to configure the Firebase database for your Android Application is shown in details. Though in this App it uses a button to update the database, but the database update can be automated using any desired concept by the App developer.
Finally in the map it shows/ displays the latest location updated in the database. It fetches the database” data on any change of data and extracts the required information from the datasnapshot variable. A bit of text processing id done to extract only the latest latitude and longitude updated in the database. The information of the latest latitude and longitude is used to move the camera on the map and put the marker accordingly.
Complete project source code of this tutorial is available at: