There will be API to access this in the next release.  I think even the
previous release from Google I/O may have had API in the
ConnectivityManager to access a LinkProperties object for each network (or
the current default network) which would contain this information.


On Thu, Aug 14, 2014 at 5:47 PM, Mihai Badea <[email protected]> wrote:

> I have the following code to determine all info about my local network on
> Wifi:
>
> WifiManager wifiMan = 
> (WifiManager)context.getSystemService(Context.WIFI_SERVICE);
> dhcpInfo = wifiMan.getDhcpInfo();
> networkAddress = ntoh(dhcpInfo.netmask & dhcpInfo.ipAddress);
> broadcastAddress = ntoh((dhcpInfo.netmask & dhcpInfo.ipAddress) | 
> (~dhcpInfo.netmask));
> netMask = ntoh(dhcpInfo.netmask);
> ipAddress = ntoh(dhcpInfo.ipAddress);
>
> However I could not find a way to get this DhcpInfo object for Ethernet.
> There is no such thing as EthernetManager....
>
> How to get the above info - while Android connected via Ethernet (USB OTG
> + Ethernet adapter)?
>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Android Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to