Skip to content

Commit

Permalink
Show IPV4 address only.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhou Chang committed Dec 12, 2012
1 parent d7044ef commit f5279ae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="teaonly.droideye"
android:versionCode="6"
android:versionName="1.5">
android:versionCode="8"
android:versionName="1.6.1">
<application android:label="@string/app_name" android:icon="@drawable/icon">
<activity android:name="MainActivity"
android:label="@string/app_name"
Expand Down
3 changes: 2 additions & 1 deletion src/teaonly/droideye/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.net.*;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import org.apache.http.conn.util.InetAddressUtils;

import android.app.Activity;
import android.app.AlertDialog;
Expand Down Expand Up @@ -207,7 +208,7 @@ public String getLocalIpAddress() {
for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) {
InetAddress inetAddress = enumIpAddr.nextElement();
//if (!inetAddress.isLoopbackAddress() && !inetAddress.isLinkLocalAddress() && inetAddress.isSiteLocalAddress() ) {
if (!inetAddress.isLoopbackAddress() ) {
if (!inetAddress.isLoopbackAddress() && InetAddressUtils.isIPv4Address(inetAddress.getHostAddress()) ) {
String ipAddr = inetAddress.getHostAddress();
return ipAddr;
}
Expand Down

0 comments on commit f5279ae

Please sign in to comment.