Search code examples
javaandroidandroid-networking

Create a connection between 2 phones


I would like to make a connection between 2 phones, defined as phone A and phone B.

A asks for B's location, and then B generates its location and sends it to A.

I know how to generate a location, but how can I create a connection between A and B? Is a database required?


Solution

  • generally you will need a server in the middle way. if you want to finish the job without a server, you have to make one of the phone to be a server, but for now carriers block all incoming connections, so your phones cannot reach each other. So set up a server, and let 2 phones connect to it, then transmit the location data.