I'm trying to implement a fast communication between two android phones at a certain moment by, preferably, going through a server (since it's easier to be consistent).
The phones have to communicate their gps locations every x seconds, with x being as low as possible, with only one of the phone having to be on the app, the other can be idle (but obviously not turned off).
The first solution I tried is a syncadapter in the app which updates every x seconds, sends requests to server writing its location in a DB, and then the other retrieves the location in the same DB.
Note : I've implemented it this way only because I already had the underlying architecture (REST API and all) beforehand, but I don't know how to do this in the real world, so feel free to cricize my initial choice and advise me on a better solution
Thank you in advance :) !
答案 0 :(得分:0)
You can look at Firebase https://www.firebase.com/ which is a real time database. It does have active listeners in the sdk to get real time updates for your GPS coordinates.
The problem you mentioned can be addressed with https://github.com/firebase/geofire-java/tree/master/examples/SFVehicles