Get peer device's IP address in wifi-direct p2p connection
There isnt. YOu need to use a service discovery protocol.
How to find Ip address of a device via wifi?
If you want to detect the ip address of the "Emulator" or android device which is connected to any Network then use this code in Your program. it will give you the exact IP Address which the network have assigned to your device.
try {
for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();)
{
NetworkInterface intf = en.nextElement();
for (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());
}
Related Topics
Libz.So.1: Cannot Open Shared Object File
Android Viewpager Get the Current View
How to Set Minimum Datepicker Date to Current Date
Why Is the Android Test Runner Reporting "Empty Test Suite"
Speed Control of Mediaplayer in Android
Trying to Uninstall_Shortcut But Shortcut Won't Go Away
How Do Task Managers Kill Apps
How to Shutdown an Android Mobile Programmatically
Text/Design Tab Missing New Android Project on Android Studio Ide
Change Package Name for Android in React Native
Android Appcompat-V7:21.0.0 Change Material Checkbox Colors
Textinputlayout :How to Give Padding or Margin to Hint
Android Studio: Unable to Start the Daemon Process
App Completely Restarting When Launched by Icon Press in Launcher
How to Take Multiple Photos Before Dismissing Camera Intent
Write_Secure_Settings Permission Error Even When Added in Manifest
Adt Doesn't Create Default Hello World But Command Line Does