Skip to content
Snippets Groups Projects
Commit 582c8c90 authored by Frantisek Simon's avatar Frantisek Simon
Browse files

Fixed network connection check for iOS.

parent d5c0e3a9
Branches
Tags
No related merge requests found
......@@ -72,7 +72,13 @@ public class IOSLauncher extends IOSApplication.Delegate {
private static class IOSConnectionManager implements IConnectionManager {
@Override
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;
}
}
......
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