14. Connection
The PhoneGap Connection object provides an application with information about the current network connection available to the application. The object exposes a single property, connection.type
, as well as the following constants:
• Connection.CELL_2G
• Connection.CELL_3G
• Connection.CELL_4G
• Connection.ETHERNET
• Connection.NONE
• Connection.UNKNOWN
• Connection.WIFI
An application will query the connection.type
property and compare the results against these constants to determine the specific type of connection available. You’ll see an example of this shortly.
Modern smartphones include multiple radios, so the device can connect to several types of networks throughout the day. The device typically maintains a constant connection ...
Get PhoneGap Essentials: Building Cross-Platform Mobile Apps now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.