Returns the active network connection of the device.
$m.getNetwork(function(response){ $m.toast("Active network - " + response.result); }); |
Syntax
$m.getNetwork([fp_callback])
Parameters
fp_callback
function (optional)
Function to execute when the network information is available. The function receives a response object as parameter, with the following property values,
- code - {Number}. Type of the network connection. Possible values are,
- $m.NETWORK_NONE - 0. No network.
- $m.NETWORK_WIFI - 1. WiFi network.
- $m.NETWORK_CELLULAR - 2. 2G/3G network.
- $m.NETWORK_OTHER - 3. Other network type.
- result - {String}. The string value of the network type.
- error - {Object}. The error object contains,
- message - {String}. A short description of the error.
- description - {String}. A detailed description of the error.