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

17. Events > Network Status Events

Network Status Events

Any mobile application that uses network-based resources should in some way monitor network availability and attempt to send or receive data across a network connection only when the network connection is available. An application can manually check the status of the device’s network connection using the PhoneGap Connection object (described in Chapter 14) before trying to utilize a network connection.

In other cases, an application will use the PhoneGap online and offline events to listen for changes in a network connection and adjust accordingly. Whenever the device loses its network connection, it will fire the offline event. When a connection becomes available again, the online event will fire. A network-savvy application will use these events to track the status of the connection and queue data for transmission only when the connection is available.


  

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