I am new to android and want to create a simple game between 2 emulators.
Emulator 1 can send a string to emulator 2 and emulator 2 can send a string back to emulator 1.
Please can someone advise me on how to go about this as I have no idea.
Thanks.
Android apps running in an emulator can connect to the network available on your workstation. However, apps connect through the emulator, not directly to hardware, and the emulator acts like a normal app on your workstation.
Android apps running in an emulator can connect to the network available on your workstation. However, apps connect through the emulator, not directly to hardware, and the emulator acts like a normal app on your workstation. This can cause some limitations:
Finally, note that the pre-allocated addresses of an emulated device are specific to the Android Emulator and will probably be very different on real devices (which are also very likely to be NAT-ed, specifically, behind a router/firewall). Android apps running in an emulator can connect to the network available on your workstation.
Android app and game developers like to test apps and games on as many devices a possible before launch. Usually the Android Studio emulator is fine for this kind of work. However, Xamarin and Genymotion are excellent for this type of use as well. The final main type is productivity.
To run 2 emulators at the same time, I would recommend running them both as virtual sessions (like in VMWare) and "bridge" the connections. Make sure you have static IP addresses for each VM.
As you're simply sending text between them, I would stick to HTTP at this stage just to get the proof-of-concept working. Just don't complicate your life too early. Http should be the easiest common denominator to work with for Wifi or Mobile carriers for now.
If you abstract the object model appropriately, you can later use other communication protocols by overriding the classes. The networking component should be transparent to the application.
You can have direct communication using SMS (just use the emulator port number as phone number to test it) or Bluetooth. If you use Wifi or Mobile phone network, then you must have both devices connected to your server, you cannot have direct connection, or even if in some cases maybe you can, then you should not relay on this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With