Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Part III. PhoneGap APIs > 14. Connection

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 to the cellular network whenever possible, which it uses for both voice and data communication. Devices typically connect to Wi-Fi networks as well, primarily for data communication but sometimes for voice communication.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial