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
  • DownloadDownload
  • PrintPrint

Solution

The core functionalities that PhoneGap makes accessible through the JavaScript API depend on the device being ready; however, JavaScript can begin working as soon as the Document Object Model (DOM) is available. Therefore, before you perform any API call, you must ensure that PhoneGap has determined that the device is ready for use.

There are two solutions for checking whether the device is ready. For iOS, Android, and BlackBerry (version 5.0 and higher), a custom event type that you can attach to the DOM is available, and PhoneGap will trigger this event when the device is ready.

Warning

For older versions of BlackBerry, PhoneGap is unable to fire the custom event, so you must perform a basic JavaScript interval check for a Boolean variable to indicate whether PhoneGap is ready or not.


  

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