Try this example
[bus2] How to broadcast a GPS location and share the information on a map in real time.
Two similar apps explore the basics of how to share a location using a single screen and a real time database. One app user beacons, the others monitor (view his/her) location map using the same app.
Share Your Location is a basic app to share a map of your location with others who have installed your app. The example tracks a single user who beacons his/her location. Provide separate Tags for other u…
Finding a bus is not much different than finding a fire location or the present location of a firetruck. The example uses the default CloudDB database.
Here is something similar
Social Distancing ... a CloudDB / Location Marker Tutorial
or
Foreground GPS Location Service experiments and Tutorial by SteveJG
Use the Android GPS receiver using a Foreground service, capture locations and a make a Track. Three examples use the CloudDB, a fourth example uses a Google Spreadsheet to store the data.Create a List of location coordinates and display a Track on a Map.
When the Foreground (KAS) service is activated:
the app will continue to post to the database when and after the device screen closes. The…