Send data via internet between two unity android app

Hi. Is there a way to send data via internet between two unity android app?
The two apps will be in different devices and not in the same net.

Since devices on the Internet are typically on a NAT, you need a server of some kind to either set up the initial communication or relay all the data. That can be a server you rent or otherwise set up yourself, or a 3rd party service. For someone to give more specific recommendations, you’ll have to be more specific with your requirements.

1 Like

Is it possible to use the mac addres to identify devices to send data?

Only between machines on the same local area network (LAN). Once you start needing to work with different networks you need to start using an approach like the one described by @Joe-Censored .

1 Like

A MAC address has no layer 3 routing information, so can’t be used to direct a packet through multiple routers towards its destination. An IP address on the other hand has all the routing information baked into the address, when combined with each router’s own routing table.

1 Like

Ok thanks. Does Unity provide a service for hosting servers?
Or else, is it possible to use a device to be the server, and providing its IP (public) to others devices, have that other devices send data to it?

No.

Yes, but all of the limitations that come with trying to connect two devices directly together come with trying to use one device as a server. If the device behaving as a server is behind a NAT then you will need to have a relay server to access it from the client devices.

I understand the desire to avoid having to deal with servers as much as possible but a relay server is both the easiest solution to this problem and very inexpensive. Amazon’s EC2, for example, is only $3/mo ($2/mo for 2 virtual cores w/ 512MB RAM, $1/mo for 10GB storage) with no charge for the bandwidth used.

https://calculator.aws/#/createCalculator?nc2=h_ql_pr_calc_smc

1 Like

Not yet, but it supposedly is in the works. My expectation is the pricing will not be all that favorable. Taking 2 years to create what is essentially a management system for Google’s existing cloud offerings also has me suspicious that Unity isn’t really taking this seriously either.

https://discussions.unity.com/t/714685

Most internet connected devices are behind a NAT today, so the IP address the device actually has is not publicly addressable. This is usually worked around either by the already mentioned relay server solution, or a technique called NAT punch through. There are also cloud networking providers which implement this kind of thing for you.