I am making an Android game. So, people are able to create groups/parties between them and I would like to give them the ability to view each member of their group moving on the Google Maps in real time. This means that I have to find a good way to update each client’s map markers in real time or pseudo-real time at least.
Would an approach with a DBMS be fine or that would be too costly? In this approach, every client should be responsible to update the DB every so with their current coordinates and thus everyone can make queries to view every other party member's lastly updated location. Making this happen within small time intervals will give the feeling to users that people are moving on Map in real time.
On the other hand, would a peer-to-peer approach handle this case in a better way? Like every group/party runs on its own by letting players exchange info between them containing everyone's new coordinates every so (interval). I believe that the second approach is better because it does not give load to our server, but there may be drawbacks. I am not sure however how easy this would be to be implemented and if Android API provides something good for this case.
Any opinion/suggestion/comment is very welcome. Please I would like to hear what you are thinking, since I have no experience on this subject and hence anything might be helpful.
Thank you in advance! Please enlighten me :)
Since the options are all a bit "costy" in terms of connection/operation, i would suggest you to check at the MQTT protocol. It's used as M2M connection with an eye to optimization. It was created for Internet of Things purposes. I've used it for non-android projects but it can be used also for that. You only need a server (broker) and i suggest Mosquitto (which is lightweight). Then every one can subscribe to a topic like: "/location/update/+" using + wildcard means every topic that is one level after "update" topic.
Then every one publishes his own position to the topic "/location/update/{MYID}" and the others will receive the position. Usually the position are retrieved only when connected, but you can manage to support a sort of "hanging" subscription by using QoS=2 when subscribing and connecting always with the same ClientName.
Does it help?