In order for an APEX application to be able to access these features there a few steps you must follow. By far the easiest method is to use build.phonegap.com, a cloud based service that allows you to quickly build mobile applications and easily compile them without SDKs, compilers or hardware.
Archive an Index.html file to a zip containing the following code:
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />
After signing up for an account or logging in with your GitHub account you can then upload this file and it will build your application, injecting the necessary files in the process.
You then choose which platform you would like, we chose android. The app that has been created does nothing apart from open your APEX application in a "chrome-less" web browser window and bridge the gap between your phone's features and the web application you created in APEX.
When PhoneGap is finished initialising, it calls the "onDeviceReady" function. This could be called anything you like and do anything you like. It is simply a callback function to handle the event, but it needs to be defined somewhere on your page or application i.e:
This will pop an alert up to let you know that it has initialised and you are now ready to safely make calls to PhoneGap function.
There is a lot you can do with PhoneGap and they are constantly updating their features and support for various devices. If you want to know what to do now that you have handled the "deviceready" event, you can browse through their API documentation which contains some very clear instructions for each feature.