Skip to main content
The network detector provides two layers of connectivity checking: a fast local check using roDeviceInfo to confirm a network interface is up, and a deeper check that probes the active server to confirm internet or LAN reachability.

Functions

GTV_IsOnline

function GTV_IsOnline() as Boolean
Checks whether the Roku device has an active network interface by calling roDeviceInfo.GetConnectionType(). Return valuetrue if GetConnectionType() returns a non-empty string (e.g. "WiFiConnection" or "WiredConnection"); false when the string is empty, indicating no network interface is up.
GTV_IsOnline only checks that a physical connection exists. It does not verify that the connection has internet access or that the backend server is reachable.
Example
if not GTV_IsOnline()
    GTV_Warn("Network", "No network interface detected")
    ' Show offline dialog
end if

GTV_GetConnectionType

function GTV_GetConnectionType() as String
Returns the raw connection type string from roDeviceInfo.GetConnectionType(). Return value — A string such as "WiFiConnection", "WiredConnection", or "" when offline. Example
connType = GTV_GetConnectionType()
GTV_Log("Network", "Connection type: " + connType)

GTV_HasInternet

function GTV_HasInternet(activeServer as String) as Boolean
Performs a full connectivity check by first confirming a network interface is up (GTV_IsOnline), then pinging the backend server (GTV_PingServer).
activeServer
String
required
The base URL of the server to ping. When empty (""), falls back to GTV_ServerPrimaryConnectivityUrl(), which returns the first LAN profile URL (or the first profile URL if no LAN profiles exist). Returns false if no URL can be determined.
Return valuetrue only if both the network interface check and the server ping succeed. Example
activeServer = m.global.activeServer
if GTV_HasInternet(activeServer)
    GTV_Log("Connectivity", "Server reachable: " + activeServer)
else
    GTV_Warn("Connectivity", "Server unreachable")
    ' Trigger reconnect flow
end if

Integration with ConnectivityTask

The ConnectivityTask calls GTV_HasInternet on a fixed 10-second loop (hardcoded interval = 10000 inside RunConnectivityTask) and updates both m.global.hasInternet and m.global.isOnline.
NET_RETRY_MS = 30 000 is a separate AppConstants value used by error dialogs and retry logic elsewhere in the app — it is not the ConnectivityTask polling interval.
The flow is:
  1. ConnectivityTask calls GTV_PingServer(m.global.activeServer) (via DoCheck()).
  2. If false, it sets m.global.hasInternet = false and m.global.isOnline = GTV_IsOnline().
  3. When true again, it sets m.global.hasInternet = true.

LAN vs internet connectivity

GTV_HasInternet does not distinguish between LAN and internet — it pings whichever server URL it receives. The distinction is made at the server profile level:
Profile typePing targetWhat a passing ping means
lanhttp://172.17.11.2:3333The local backend server is reachable
wanhttps://admin.globaltv.latThe public internet backend is reachable
When GTV_HasInternet is called with an empty activeServer, it uses GTV_ServerPrimaryConnectivityUrl(), which always prefers the first LAN profile. This means connectivity checks default to the local server when one is configured.
To check public internet connectivity specifically, pass a WAN server URL directly rather than relying on the fallback.

Health check dependency

Both GTV_HasInternet and GTV_FindActiveServer (in ServerManager) rely on GTV_PingServer from HealthCheck.brs. That function issues an HTTP GET to <baseUrl>/health with a TIMEOUT_HEALTH = 2500 ms timeout and treats any response with an HTTP status code below 500 as a passing ping.
' From HealthCheck.brs
function GTV_PingServer(baseUrl as String) as Boolean
    url = baseUrl + "/health"  ' PATH_HEALTH = "/health"
    ' ... issues async GET with 2500ms timeout
    ' Returns true for HTTP 200–499, false on timeout or 5xx
end function

Build docs developers (and LLMs) love