Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

PhoneGap / Cordova File Download

View gist:3012358
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
var fileSystem;
var documentRoot;
 
function onAppReady() {
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, function() {});
}
 
function gotFS(fileSystem) {
fileSystem = fileSystem;
documentRoot = fileSystem.root.fullPath;
}
 
function downloadFile() {
var filePath = 'PATH TO YOUR FILE'; //For example: http://example.com/bigmovie.mpg
var localFileName = 'YOUR FILE NAME'; //For example: bigmovie.mpg
var ft = new FileTransfer();
ft.download(
filePath,
localFileName,
function(entry) {
alert('File Downloaded');
},
function(error) {
//Handle the error
}
);
}
 
document.addEventListener("deviceready", onDeviceReady, false);

Do you know how I can get that to work for the inAppPurchaseManager. I have a github here with my example code on how I do it when unlocking products, but my main goal is to be able to download the magazine from my server then view it on my app. Any help you can give would be awesome! https://github.com/usmart/InAppPurchaseManager-EXAMPLE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.