PG2
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Leveraging PhoneGap APIs<br />
29<br />
HelloWorld3 Application<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
function onBodyLoad() {<br />
document.addEventListener("deviceready", onDeviceReady,<br />
false);<br />
}<br />
function onDeviceReady() {<br />
//Get the appInfo DOM element<br />
var element = document.getElementById('appInfo');<br />
//replace it with specific information about the device<br />
//running the application<br />
element.innerHTML = 'PhoneGap (version ' +<br />
device.phonegap + ')' + device.platform + ' ' +<br />
device.name + ' (version ' + device.version + ').';<br />
}<br />
<br />
<br />
<br />
HelloWorld3<br />
This is a PhoneGap application that makes calls to the<br />
PhoneGap APIs.<br />
Waiting for PhoneGap Initialization to<br />
complete<br />
<br />
<br />
Figure 2-3 shows a portion of the application’s screen when running on the Black-<br />
Berry Torch 9800 simulator.