Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // **** PHONEGAP SECTION ****
- // Wait for device API libraries to load
- setTimeout(onLoad, 10000); // xx seconds into use of the app, start up the PhoneGap processes. Note that this is not the
- // optimal way, but it'll do for now (doesn't go on at earliest ready moment, nor does it account for browsers)
- // Reference: http://docs.phonegap.com/en/3.4.0/cordova_events_events.md.html#deviceready
- function onLoad() {
- document.addEventListener("deviceready", onDeviceReady, false); // call onDeviceReady once PhoneGap is ready
- }
- // device APIs are available
- //
- function onDeviceReady() {
- // Now safe to use device APIs via Phonegap
- alert("Phonegap is successfully up and listening..."); // <--- success
- document.addEventListener("backbutton", onBackKeyDown, false);
- document.addEventListener("menubutton", onMenuKeyDown, false);
- }
- function onBackKeyDown() {
- alert("Someone hit the backbutton..."); // <--- this doesn't work, yet...
- } // end of onBackKeyDown function
- function onMenuKeyDown() {
- alert("Someone hit the menubutton..."); // <--- somehow this works. Go figure.
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement