2012-10-13 84 views
0

我正在构建一个使用Phonagap和jquery mobile的android应用程序。Phonegap下载mp3文件

在应用程序中,我需要下载一些MP3-文件,但它不会工作

这里是我的功能:

function downloadFile() { 

var fileTransfer = new FileTransfer(); 
var uri = encodeURI("http://media.domain.com/myfile.mp3"); 
var filepath = remoteFile.substring(remoteFile.lastIndexOf('/')+1); 

fileTransfer.download(
    uri, 
    filePath, 
    function(entry) { 
     console.log("download complete: " + entry.fullPath); 
    }, 
    function(error) { 
     console.log("download error source " + error.source); 
     console.log("download error target " + error.target); 
     console.log("upload error code" + error.code); 
    } 
); 



} 

我在做什么错..?

+0

也许你想尝试http://plugins.cordova.io/#/package/de.fastr.phonegap.plugins.downloader –

回答

0

remoteFile似乎没有设置。