Your application may include an option for users to update or change settings, or perhaps the ability to truly exit the application gracefully by closing down all services and storing state or data.
In this recipe, we will create a simple application that interacts with the device's native menu button to create a sliding submenu:
Firstly, create a new PhoneGap project named
submenu
by running the following command:phonegap create submenu com.myapp.submenu submenu
Add a devices platform. You can choose to use Android as follows:
cordova platform add android
Open
www/index.html
and let's clean up unnecessary elements. We'll also manipulate the DOM elements, so include a reference to thexui.js
file within thehead
tag. We will include anonLoad
method call within thebody
tag, which will set thedeviceready
event listener once the DOM is fully loaded:<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <...