Android Question Internet Connection & CloudRail Problems

stu14t

Active Member
Licensed User
I'm in the process of upgrading an old app (originally from 2015) and changing a few things within the app itself.

Everything seems to be working OK accept the internet connection (maybe).

The reason for the need internet is I'm implementing CloudRail into my app and it will not Initialize. The line below is in Sub Activity_Create

B4X:
cr.Initialize("DCPData","5a033652d052b96XXXXXXXX")


I'm using the following to check for an internet connection:

B4X:
Sub CheckConnection As Boolean
    'Requires Phone Library
    Dim p As Phone
    Log(p.GetDataState)
    Log(p.GetNetworkType)
    Dim Response, Error As StringBuilder
    Response.Initialize
    Error.Initialize
    'Ping Google DNS - if you can't reach this you are in serious trouble!
    p.Shell("ping -c 1 8.8.8.8",Null,Response,Error)
    Log("======= Response ========")
    Log(Response)
    Log("======= Error ===========")
    Log(Error)
    Log("======================")

    If Error.ToString="" Then
        Return True
    Else
        Return False
    End If
End Sub

and get the following from the Logs:


** Activity (main) Pause, UserClosed = false **
Ignoring event: txtclient_focuschanged
** Activity (main) Resume **
DISCONNECTED
UNKNOWN
======= Response ========
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=58 time=34.6 ms
--- 8.8.8.8 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 34.639/34.639/34.639/0.000 ms
======= Error ===========
======================
DISCONNECTED
UNKNOWN
======= Response ========
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=58 time=30.3 ms
--- 8.8.8.8 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 30.388/30.388/30.388/0.000 ms
======= Error ===========
======================

So there is an internet connection but the GetDataState and GetNetworkType cannot see that for some reason.

This App has used the internet before but now does not for some reason.

Any ideas gratefully received.
 
Last edited:

stevel05

Expert
Licensed User
Do you have Wifi turned on on the device?
 
Upvote 0

stevel05

Expert
Licensed User
The phone GetDataState and NetworkType relate to the CellData network, so DISCONNECTED and UNKNOWN are not unexpected results for a tablet unless it also has a SIM card.
 
Upvote 0

stu14t

Active Member
Licensed User
Ah, ok then.

I still have the issue of CloudRail not Initialising, sounds like they are unrelated then.
 
Upvote 0

stevel05

Expert
Licensed User
I've not used CloudRail so can't help you there I'm afraid. It may be a good idea to change the title to include Cloudrail, or make a new post. Someone that uses it will then be able to find your request.
 
Last edited:
Upvote 0
Top