iOS Question Reachability fail

QtechLab

Active Member
Licensed User
Longtime User
Hey guys do you know why i can't compile after added this code?
I've added the "Reachability" libraries to the external libraries folder

B4X:
#Region "Check WIFI"

#If OBJC

#import "Reachability.h"

-(void)ReachabilityStatus
{   
    if([[Reachability reachabilityForLocalWifi] curentReachabilityStatus] != ReachableViaWiFi)
    {
        [self.bi raiseEvent:nil event:@"Reachability_Result:" params:@"0"];
    }
    else
    {
        [self.bi raiseEvent:nil event:@"Reachability_Result:" params:@"1"];
    }
}

#End if

Sub Reachability_Result(text As String)
    If text = "0" Then
        'NoWifi
        Msgbox("No wifi connection", " Wifi")
    Else
        '3G and others
        Msgbox("Wifi connection enable", "Wifi")
    End If
End Sub

Sub WifiConnection
    Dim no As NativeObject
    no.RunMethod("ReachabilityStatus:", Array(""))
End Sub

#End Region
 

QtechLab

Active Member
Licensed User
Longtime User
i tried it in order to get network status, in objective C Reachability library tell you if you use 3G, WiFi, etc... i need to know if the user has the Wifi connected to a network
 
Upvote 0

Pendrush

Well-Known Member
Licensed User
Longtime User
Try this

B4X:
Public Sub CheckNet As String

    Dim myLan As ServerSocket

    If myLan.GetMyWifiIP <> "127.0.0.1" Then
        Return("wifi")
    End If
   
    If myLan.GetMyIP <> "127.0.0.1" Then
        Return("3g")
    End If
   
    Return("nonet")
   
End Sub
 
Upvote 0
Top