Search code examples
androidtimeoutxmppadbasmack

Does 10.0.2.2 work on physical device?


I can't connect to my local xmpp server while debugging from my LG L9 phone (Android 4.1.2) connected via USB. I'm connecting to 10.0.2.2:5222, but still getting timeout exception. Can this loopback address be used on physical device too or is it available just for emulator?


Solution

  • So, i tried to connect with 10.0.2.2:5222 from emulator to Openfire (xmpp server) running on my laptop (localhost) and it WORKS!

    So yes, 10.0.2.2 only works with android emulator, not physical device connected via usb. If somebody wants to use physical device, he needs to create LAN (where xmpp server is connected) and connect traditionally with WiFi (so USB cable do not provide network connection between phone and computer, to which the phone is connected).