Why this? There is already a display for local address. To know the public address you have to ask a remote server, since it can know your public address.
If you want I have a little piece of code to do that.
Why this? There is already a display for local address. To know the public address you have to ask a remote server, since it can know your public address.
If you want I have a little piece of code to do that.
@TheMightySwe below is the link to the latest source code for the B4A-Bridge, you can download the source code and modify it for your own personal use. How are you connecting your device to an Ethernet cable, I presume that you are using one of these?
Anyway you can use the code below and modify B4A-Bridge to do what you need it to do. Actually thinking about, the B4A-Bridge becomes redundant if you are connecting an Ethernet cable to your device, that means your device is no longer wireless. Why don't you just use USB debugging instead.
The device does not have USB, its a old POS system. And B4A-Bridge works but I have to see the IP in a other program. The FTP server. Just annoying. But I will check out the B4A Code.
If @Erel want to put the code in the real version it would be great.
Put an extra label named lblLanIp in the designer
Add the label in Globals
Dim lblLanIp As Label
B4X:
Sub UpdateIp
Dim ip As String
ip = server.GetMyWifiIP
If ip = "127.0.0.1" OR ip.Contains(":") Then
ip = "Not connected to wireless network."
End If
lblIp.Text = "My IP: " & ip
Dim ip As String
ip = server.GetMyIP
If ip = "127.0.0.1" OR ip.Contains(":") Then
ip = "Not connected to LAN network."
End If
lblLanIp.Text = "My LAN IP: " & ip
End Sub
In service1.bas
B4X:
Sub PE_ConnectivityChanged (NetworkType As String, State As String, Intent As Intent)
If NetworkType = "WIFI" Then CallSub(Main, "UpdateIp")
If NetworkType = "ETH" Then CallSub(Main, "UpdateIp")
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.