0

I need to transmit GPS position information from one device to another but passing through my database to store the information. Something like Uber does when they show you the position of a vehicle. I was wondering what the best means of doing this would be in Android. I was thinking about firebase to transmit notifications and use the payload to transmit this data but I am not sure if this is the correct way of doing it. I see there is also a real time database in firebase which syncs information across all connected devices. Could this be a solution?

Fabrizio Mazzoni
  • 1,831
  • 2
  • 24
  • 46
  • Literally any database can do the job. I'd actually avoid an auto syncing one, as you then don't control the frequency of messages and can either overload devices, or not send them frequently enough – Gabe Sechan May 30 '19 at 13:16
  • 1
    I have implemented this functionality using FCM with the topic in that one application published location every 2 seconds and other application subscribe that topic and getting the location. – ViramP May 30 '19 at 13:16
  • @GabeSechan yes indeed, the only issue I see is how to identify the specific device. Otherwise I''d have to check the database for updates regularly whereas with firebase that takes care of the problem. – Fabrizio Mazzoni May 30 '19 at 13:19
  • 1
    @FabrizioMazzoni Standard push messaging will get the data to the devices without needing to check the db on the client side. And the problem with syncing is you better really get the channel setup right, or you'll end up with a privacy nightmare as everyone gets access to everyone else's data. And you need to secure the client side of the db to ensure nobody can access it on rooted devices to upload bad data. I'd much rather go with a REST API for uploading your location and push messaging for sending locations back to the device. – Gabe Sechan May 30 '19 at 13:27

1 Answers1

1

Firebase will do the job. Connect two apps to firebase project - from app A write location, from app B red location with onChildChange listener.

MarkWalczak
  • 1,532
  • 3
  • 16
  • 24