getNetwork

Network

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,

  1. code - {Number}. Type of the network connection. Possible values are,
  1. $m.NETWORK_NONE                                          - 0. No network.
  2. $m.NETWORK_WIFI                                          - 1. WiFi network.
  3. $m.NETWORK_CELLULAR         - 2. 2G/3G network.
  4. $m.NETWORK_OTHER                 - 3. Other network type.
  1. result - {String}. The string value of the network type.
  2. error -  {Object}. The error object contains,
  1. message - {String}. A short description of the error.
  2. description - {String}. A detailed description of the error.