I use this piece of code to check airplane mode on an iPhone. Some users complain that it gives "True" even when they are on a network. Is there something wrong?
B4X:
Sub Device_AirPlaneMode() As Boolean
Dim R As Boolean = False
Dim myLan As ServerSocket 'ignore
Dim sDeviceIP As String = myLan.GetMyWifiIP
If sDeviceIP = "127.0.0.1" Then
R = True
End If
Return r
End Sub
Your code looks correct. In most cases it is better not to make any check and just try to connect to the desired destination. If it works it works and if not you show a message that there is no connection.