O'Reilly logo

PhoneGap Essentials: Building Cross-Platform Mobile Apps by John M. Wargo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required