Getting the IP Address of an Android Device using it's hotspot from another android device -


i have 2 android enabled devices.on 1 device turned on hotspot , other device connecting hotspot. want ip address of first device. how can it. because want send file first device that's why need ip address of device.i assuming wifimanager used purpose don't know how. read other threads using networkinterface purpose.

-usman

try {  (enumeration<networkinterface> en = networkinterface.getnetworkinterfaces(); en.hasmoreelements();)  {   networkinterface intf = en.nextelement();        (enumeration<inetaddress> enumipaddr = intf.getinetaddresses();enumipaddr.hasmoreelements();)     {      inetaddress inetaddress = enumipaddr.nextelement();      if (!inetaddress.isloopbackaddress())       return inetaddress.gethostaddress().tostring();     }  }  }  catch (socketexception ex)   {     log.e("serveractivity", ex.tostring());   } 

Comments