Retrieve IPv6 address for WiFi interface

by IPv6Project » Fri, 20 May 2011 01:26:21 GMT

Sponsored Links
 Dear all !

I am currently developping an application using sockets to communicate
over an IPv6 network.

However I am unable to retrieve the ipv6 address of the WiFi interface

My code works only for IPv4 :(

Is there anyway to adapt this code to retrieve only IPv6 address
(global) of the wifi interface?

Many thanks in advance,

I am using following code:

private String getLocalIpAddress() {
        try {
            for (Enumeration<NetworkInterface> en =
NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) {
                NetworkInterface intf = en.nextElement();
                for (Enumeration<InetAddress> enumIpAddr =
intf.getInetAddresses(); enumIpAddr.hasMoreElements();) {
                    InetAddress inetAddress =
                    if (!inetAddress.isLoopbackAddress()) { return
inetAddress.getHostAddress().toString(); }
        } catch (SocketException ex) {
            Log.e("ServerActivity", ex.toString());
        return null;


Other Threads

1. Slide Transitions between activities - Disable in application on 1.5?

You mean the window animations?  The ones that are off by default?  You go
into Settings -> Sound & Display -> Animation and check it off.


Faber Fedor
Linux New Jersey


2. UNLOCK Screen lock programatically

We are writing an app to substitute screen/pattern lock on G1.
Unfortunately, it is impossible to substitute the original screen lock
with a 3rd party one.

The only option left is if we can UNLOCK the phone from a service
running in the background when G1 is locked.
Is it possible?
Is there interface to Pattern/Screen lock?
What is KeyguardManager for?


3. Facebook application

4. XML+XPath on Android using dom4j and Jaxen

5. setBuiltInZoomControls and debugging problems

6. How to detect if sound is currently playing on the speaker?

7. Database - error code 5