diff --git a/app/build.gradle b/app/build.gradle index 8f37a376..6e94e78f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -70,6 +70,5 @@ dependencies { // Third-party implementation 'cat.ereza:customactivityoncrash:2.3.0' implementation 'org.nanohttpd:nanohttpd:2.3.1' - //implementation 'com.maxmind.db:maxmind-db:2.0.0' implementation 'com.github.KaKaVip:Android-Flag-Kit:v0.1' } \ No newline at end of file diff --git a/app/src/main/java/com/emanuelef/remote_capture/Utils.java b/app/src/main/java/com/emanuelef/remote_capture/Utils.java index 7fbe5a61..7b65e1f9 100644 --- a/app/src/main/java/com/emanuelef/remote_capture/Utils.java +++ b/app/src/main/java/com/emanuelef/remote_capture/Utils.java @@ -276,6 +276,10 @@ public class Utils { } // https://gist.github.com/mathieugerard/0de2b6f5852b6b0b37ed106cab41eba1 + // API level 31 requires building a NetworkRequest, which in turn requires an asynchronous callback. + // Using the deprecated API instead to keep things simple. + // https://developer.android.com/reference/android/net/wifi/WifiManager#getConnectionInfo() + @SuppressWarnings("deprecation") public static String getLocalWifiIpAddress(Context context) { WifiManager wifiManager = (WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE); WifiInfo connInfo = wifiManager.getConnectionInfo(); @@ -335,7 +339,7 @@ public class Utils { && !addr.equals(vpn_ip)) { String sAddr = addr.getHostAddress(); - if ((addr instanceof Inet4Address) && !sAddr.equals("0.0.0.0")) { + if ((sAddr != null) && (addr instanceof Inet4Address) && !sAddr.equals("0.0.0.0")) { Log.d("getLocalIPAddress", "Using interface '" + intf.getName() + "' IP: " + sAddr); return sAddr; } @@ -401,9 +405,12 @@ public class Utils { }; } + // API level 31 requires building a NetworkRequest, which in turn requires an asynchronous callback. + // Using the deprecated API instead to keep things simple. + // https://developer.android.com/reference/android/net/ConnectivityManager#getAllNetworks() + @SuppressWarnings("deprecation") public static boolean hasVPNRunning(Context context) { ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); - if(cm != null) { Network[] networks = cm.getAllNetworks(); diff --git a/build.gradle b/build.gradle index fdfc4949..1058a4d9 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.0.3' + classpath 'com.android.tools.build:gradle:7.0.4' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -20,7 +20,7 @@ allprojects { maven { url 'https://jitpack.io' } } tasks.withType(JavaCompile) { - options.compilerArgs << "-Xlint:deprecation" + options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" } } diff --git a/submodules/MaxMind-DB-Reader-java b/submodules/MaxMind-DB-Reader-java index 778acb6f..91325b34 160000 --- a/submodules/MaxMind-DB-Reader-java +++ b/submodules/MaxMind-DB-Reader-java @@ -1 +1 @@ -Subproject commit 778acb6fc055547eeb7f214d6903866855bb8887 +Subproject commit 91325b34b13384a36e230b4c6862f46d00015bd1