Get ready to download a file and display in the PhoneGap default app template a progress bar and a link to the file. Refer to the following steps:
Open the command-line tool and create a new PhoneGap project named
DownloadFile
.$ cordova create ~/the/path/to/your/source/downloadfile com.gnstudio.pg.DownloadFile DownloadFile
Add the FileTransfer API plugin using the command line.
$ cordova plugins add https: //git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer.git
Go to the
www
folder, open theindex.html
file, and add aprogress
tag with theid
valueprogress
inside the maindiv
element of the app below thedeviceready
tag; assign1
to thevalue
attribute and100
to themax
attribute.<progress id='progress' value='1' max='100'></progress>
Go to the
www/js
folder, open theindex.js
file, and define a new function namedrequestFileSystem
and request access to the filesystem.requestFileSystem: function () { var size ...