Hi I am creating a project. It is about tracking a driver. The driver must send his location every 5 seconds to the Firebase. My problem is how do the passenger retrieve the location of the driver every 5 seconds too.
Asked
Active
Viewed 1,596 times
-6
-
Possible duplicate of [Good way of getting the user's location in Android](http://stackoverflow.com/questions/6181704/good-way-of-getting-the-users-location-in-android) – Shabbir Dhangot Sep 26 '16 at 11:12
-
If your driver sends the location to the Firebase Database, any connected passengers will automatically receive that location. See the Firebase documentation on how to retrieve data from the database: https://firebase.google.com/docs/database/android/retrieve-data – Frank van Puffelen Sep 26 '16 at 14:26
1 Answers
1
In a nutshell:
LocationRequest locationrequest = LocationRequest.create();
locationrequest.setInterval(5000); // 5 seconds
LocationClient locationclient = new LocationClient(this, this, this);
locationclient.requestLocationUpdates(locationrequest, this);
https://developer.android.com/training/location/index.html
In this link, it is suggested that you use the new Google Play services location APIs
. But they have the same idea.

user1506104
- 6,554
- 4
- 71
- 89