This is a migrated thread and some comments may be shown as answers.

FileTransfer is not defined

6 Answers 358 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Richard
Top achievements
Rank 1
Richard asked on 06 Oct 2013, 05:40 PM
I have a script that works under IOS but not under Android. Using Weinre this is what I got:

processMessage failed: Message: S01 Capture1165431115 [{"lastModifiedDate":1381080555000,"fullPath":"file:\/\/\/mnt\/sdcard\/DCIM\/Camera\/VID_20131006_132911.mp4","type":"video\/mp4","size":1538739,"name":"VID_20131006_132911.mp4"}]
processMessage failed: Error: ReferenceError: FileTransfer is not defined

I checked to make sure filetransfer is enabled in the config.xml 

It works great on my iphone but Just not on Android 4.  Any ideas or should I just not use the filetransfer plugin?

6 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 07 Oct 2013, 12:29 PM
Hi Rich,

The plugins listed in the Android config.xml are no longer taken into account since Cordova 3.0, we've just forgotten to remove them. In the current version of Icenium, you cannot remove any of the core Cordova plugins, your app uses all by default including the File API.

Are you using FileTransfer to download or upload a file? What does your script do exactly and is it supported by Cordova and the Android WebView? You can review our file transfer sample that shows how it is used to download a file. You can refer to the Cordova File API for example how to upload a file.

Regards,
Steve
Telerik
You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Share feedback and vote for features on our Feedback Portal.
0
Richard
Top achievements
Rank 1
answered on 07 Oct 2013, 05:22 PM
I am using upload. Basically, after I capture an image or video or audio it is supposed to upload the result. The capturesuccess is called with the path and it works great on IOS.  On Android though it fails on line 6.

Here is the code: 

01._captureSuccess:function(capturedFiles) {
02.    var i;
03.    for (i=0;i < capturedFiles.length;i+=1) {
04.        var mediaFile = capturedFiles[i];
05.        console.log('Captured Successfully trying to upload now...');
06.        var ft = new FileTransfer(),
07.        path = mediaFile.fullPath,
08.        name = mediaFile.name;
09. 
10.        $('#media').html(path + ' :: ' + name);
11.         
12.        ft.upload(path,
13.                  "http://www.xxxxxx.com/test/upload.php",
14.                  function(result) {
15.                    console.log('Upload success: ' + result.responseCode);
16.                    console.log(result.bytesSent + ' bytes sent');
17.                     $("#file-list").data("kendoMobileListView").dataSource.read();
18.                  },
19.                  function(error) {
20.                    alert('Error uploading file ' + path + ': ' + error.code);
21.                  },
22.                  { fileName: name });
23.         
24.    }
25.}
0
Richard
Top achievements
Rank 1
answered on 08 Oct 2013, 12:34 PM
It appears that the Device Ready is not firing on Android so that Cordova isn't working.

I changed my device ready trying to get it to run, but nothing I do gets it to fire under Android.
document.addEventListener("deviceready", function(){
    console.log('onDeviceReady');
    captureApp = new captureApp();
    captureApp.run();
    ft = new FileTransfer();
},true);
0
Steve
Telerik team
answered on 09 Oct 2013, 01:10 PM
Hello Rich,

There are numerous threads elaborating on possible culprits that could cause the deviceready event not to fire. If you are unable to identify the problem on your end, please let us know the name of your project and we would take a look at it.

Regards,
Steve
Telerik
You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Share feedback and vote for features on our Feedback Portal.
0
Richard
Top achievements
Rank 1
answered on 09 Oct 2013, 02:06 PM
I figured it out last night. End result was that there was no problem with the code. When I created the original file it was a sample with an older version of Cordova, I switched it to V3 but apparently that didn't fully work right. I archived it. Created a blank Cordova V3 project and imported my files in and ouila it worked beautifully.
0
Steve
Telerik team
answered on 09 Oct 2013, 02:09 PM
Hello Rich,

Can you still let us know the name of your app that does not work, so we can investigate what goes wrong when switching Cordova version?

Regards,
Steve
Telerik
You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Share feedback and vote for features on our Feedback Portal.
Tags
General Discussion
Asked by
Richard
Top achievements
Rank 1
Answers by
Steve
Telerik team
Richard
Top achievements
Rank 1
Share this question
or