Determine the connection type (Edge, 3G, 4G, Wifi)


#1

Hi, is there a way to detect the connection type and/or subscribe to something like “onNetworkTypeChanged” event?
related links for iOS and Android

https://developer.apple.com/library/content/samplecode/Reachability/Introduction/Intro.html


#2

You can use something along the following lines:

forge.event.connectionStateChange.addListener(function () {
    if (forge.is.connection.connected() && forge.is.connection.wifi()) {
        // connected via WiFi
    } else if (forge.is.connection.connected()) {
        // connected via Edge/3G/4G
    } else {
        // no network connectivity
    }
}, function (e) {
    // handle any errors
});

More info: https://trigger.io/docs/current/api/core/event.html