Skip to content
Snippets Groups Projects
Commit 1ad52357 authored by Matyáš Latner's avatar Matyáš Latner
Browse files

Merge branch 'fix-3.0.1-ios-connection-check' into 'fix-3.0.1'

Fixed network connection check for iOS.



See merge request !295
parents 39b99220 582c8c90
Branches
Tags
No related merge requests found
...@@ -72,7 +72,13 @@ public class IOSLauncher extends IOSApplication.Delegate { ...@@ -72,7 +72,13 @@ public class IOSLauncher extends IOSApplication.Delegate {
private static class IOSConnectionManager implements IConnectionManager { private static class IOSConnectionManager implements IConnectionManager {
@Override @Override
public boolean isUsingMobileData() { public boolean isUsingMobileData() {
SCNetworkReachabilityFlags flags = SCNetworkReachability.create(new InetSocketAddress(CONNECTION_CHECK_HOST, CONNECTION_CHECK_PORT)).getFlags(); InetSocketAddress socketAddress = new InetSocketAddress(CONNECTION_CHECK_HOST, CONNECTION_CHECK_PORT);
// RoboVM tries to retrive IP address using network connection. If we don't have it InetSocketAddress.getAddress() returns null
// in that case SCNetworkReachability.create(socketAddress) throws IllegalArgumentException
if (socketAddress.getAddress() == null) {
return false;
}
SCNetworkReachabilityFlags flags = SCNetworkReachability.create(socketAddress).getFlags();
return flags.compareTo(SCNetworkReachabilityFlags.IsWWAN) == 1; return flags.compareTo(SCNetworkReachabilityFlags.IsWWAN) == 1;
} }
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment