Get ready to render the first available image in the device's storage into the PhoneGap default app template. Refer to the following steps:
Open the command-line tool and create a new PhoneGap project named
ReadingFile
.Go to the
www
folder, open theindex.html
file, and add animg
tag with the id valuefirstImage
inside the main div of the app below thedeviceready
one.<img id='firstImage' />
Go to the
www/js
folder, open theindex.js
file, and define a new function namedrequestFileSystem
.requestFileSystem: function () { // The request of access to the file system will go here }
Define the error handler in order to get the code of every possible error.
onError: function(error){ navigator.notification.alert(error.code, null); }
In the body of the function
requestFileSystem
, access the device filesystem using therequestFileSystem
function of theLocalFileSystem
object, define the success and failure handlers, and, inside the...