You will need to use an external service for this.
Such as this one: https://www.ipify.org/
Cross platform code: depends on iHttpUtils2 / OkHttpUtils2 and Json libraries
B4X:
'Returns an empty string if ip not available.
Private Sub FindExternalIp As ResumableSub
Dim j As HttpJob
j.Initialize("", Me)
j.Download("https://api.ipify.org?format=json")
Wait For (j) JobDone(j As HttpJob)
Dim ip As String = ""
If j.Success Then
ip = j.GetString.As(JSON).ToMap.Get("ip")
Else
Log(LastException)
End If
j.Release
Return ip
End Sub
Usage:
B4X:
Wait For (FindExternalIp) Complete (ip As String)
Log(ip)