开发者

How can I get netmask from Android device?

I need to get the netmask and ip from the Android so I can calculate all the IP's within my subnet range.

I've been searching and so far I've found this: Programmatically getting the gateway and subnet mask details

The problem is that it doesn't work for all devices. For instance, it doesn't work in the emulator (any Androi开发者_如何学Pythond version) and it doesn't work either in my Archos 7HT with Android 1.5. It returns 0 for netmask and gateway.

Is there any way to do it? Is there any system file which I could read that contains this info?? (something like this: http://www.flattermann.net/2011/02/android-howto-find-the-hardware-mac-address-of-a-remote-host/).

In my advanced wifi settings I can see these settings, so there must be a way to retrieve them...

Thanks.


Try with APIs InetAddress and NetworkInterface. Emulator has no WIFI, hence is not possible to get address with Wifi API.

Check this reply

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜