IBM Worklight v5.0.5 > API reference > IBM Worklight client-side API > JavaScript client-side API

WL.Device.getNetworkInfo

Fetch network information from the device and return them to the specified callback function. Available on Android and iOS.


Return Value

The callback function receives a JSON structure with the following properties:

Property Description Availability on Android Availability on iOS
isNetworkConnected Whether the device has an IP address (that is, it is connected through Wi-Fi or a mobile network) Yes Yes
isAirplaneMode Whether the device is in airplane mode or not Yes No
isRoaming Whether the device is roaming (not on its home mobile network) Yes No
networkConnectionType Returns mobile or WIFI Yes Yes
wifiName Name of the Wi-Fi network, if connected Yes No
telephonyNetworkType Type of the mobile network (such as HSDPA or EDGE) Yes No
carrierName Name and ID of the mobile carrier Yes No
ipAddress IP address of the device Yes Yes


Example

WL.Device.getNetworkInfo(function (networkInfo) {
alert (networkInfo.ipAddress); });


Parent JavaScript client-side API