Skip to content
joerg86Public

About

Advanced file transfer plugin for phonegap

Resources

Stars

2 stars

Watchers

1 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

PhoneLoad plugin

This plugin provides you with an advanced FileTransfer interface. It makes it possible to retrieve status information of a currently running download through a callback and allows you to cancel a running transfer as well. We have added that functionality to the upload function as well, but currently only for the iOS version. Use at your own risk. :o)

Add the plugin to your project

Android

Load the JavaScript code in your HTML file: <script src="phonegap-phoneload-android.js"></script>

Add this line to res/plugins.xml: <plugin name="PhoneLoad" value="biz.sawatzki.phoneload.PhoneLoad"/>

Add the "src" folder to your java classpath.

iOS

Load the JavaScript code in your HTML file: <script src="phonegap-phoneload-ios.js"></script>

Add "PhoneLoad.m" and "PhoneLoad.h" to the "Plugins" directory in your Xcode project. Open PhoneGap.plist in your project's "Supporting Files" folder and add a new entry to the "Plugins" dictionary: Use "biz.sawatzki.phoneload" as key and "PhoneLoad" as value (type is "String").

How to use the plugin

var ft = new window.plugins.phoneLoad.FileTransfer();
ft.download(url, target, successCB, errorCB);

The successCB callback is periodically provided with a FileDownloadResult object that looks like this:

{ completed: false, // whether the download is still in progress or not
bytesReceived: 1000, // the amount of bytes already downloaded
bytesTotal: 2000, // the total amount of bytes to load
percentCompleted: 50.0, // for convenience: the overall progress in percent
responseCode: 200, // the HTTP response code
}

Cancel a running download with the cancel() function:

ft.cancel()

This will cancel the download and call the errorCB once.

About

Advanced file transfer plugin for phonegap

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages