How to get a IPv6 Global Unicast Address on android phone?
<p>Execute command "adb shell ip -6 -addr show", It will show below,</p>

<p>inet6 2001:b021:15:2061:f505:ac16:bed3:7584/64 scope global temporary dynamic
       valid_lft 604559sec preferred_lft 85559sec
inet6 2001:b021:15:2061:422c:f4ff:fed3:9f2b/64 scope global dynamic</p>

<p>But which one is a global Unicast Address? The following codes can list all IPv6 address. But how to know which one is a IPv6 Global Unicast Address?</p>

<pre><code>for (Enumeration&lt;NetworkInterface&gt; en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) {
    NetworkInterface intf = en.nextElement();
    for (Enumeration&lt;InetAddress&gt; enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) {
              InetAddress inetAddress = enumIpAddr.nextElement();
             if (!inetAddress.isLoopbackAddress()) {
                return inetAddress.getHostAddress().toString();
            }
        }
    }
</code></pre>
