PhoneGap Playbook文件传输

时间:2012-03-02 16:58:49

标签: cordova blackberry-playbook

尝试使用2.2 SDK在BlackBerry Playbook OS 2.0中调用FileTransfer方法时出错。我正在使用PhoneGap 1.4.0,我的应用程序工作正常,除了设备上的这部分。这是我用于测试的测试功能。

     test(){
      var myfile = new FileTransfer();
      myfile.download(
                          'http://www.waterhobo.com/icancolor/html/images/galley2.gif',
                            "file:///accounts/1000/shared/photos/test.png",
                            function(result) { console.log("download complete: " +
                                                                  result.fullPath);},
                            function(error) {
                                               console.log("download error source " + 
                                                                        error.source);
                                               console.log("download error target " + 
                                                                        error.target);
                                               console.log("upload error code" + 
                                                                           error.code);
                                            }
                           );
         }

我得到的错误是:

Error: Status=2 Message=Class FileTransfer cannot be found
book.js:152download error source undefined
book.js:153download error target undefined
book.js:154upload error codeundefined
book.js:514

看起来它无法在phonegap.js文件中找到该方法,但我已经确认它在那里。

config.xml如下所示:

 <widget xmlns="http://www.w3.org/ns/widgets"
    xmlns:rim="http://www.blackberry.com/ns/widgets"
version="1.0.1.0">
  <name>iCanColor</name>

  <description>
    A child Activity
  </description>

  <license href="http://opensource.org/licenses/alphabetical">
  </license>

  <!-- PhoneGap API -->
  <feature id="blackberry.system" required="true" version="1.0.0.0" />
  <feature id="com.phonegap" required="true" version="1.0.0" />
  <feature id="blackberry.find" required="true" version="1.0.0.0" />
  <feature id="blackberry.identity" required="true" version="1.0.0.0" />
  <feature id="blackberry.pim.Address" required="true" version="1.0.0.0" />
  <feature id="blackberry.pim.Contact" required="true" version="1.0.0.0" />
  <feature id="blackberry.io.file" required="true" version="1.0.0.0" />
  <feature id="blackberry.utils" required="true" version="1.0.0.0" />
  <feature id="blackberry.io.dir" required="true" version="1.0.0.0" />
  <feature id="blackberry.app" required="true" version="1.0.0.0" />
  <feature id="blackberry.app.event" required="true" version="1.0.0.0" />
  <feature id="blackberry.system.event" required="true" version="1.0.0.0"/>
  <feature id="blackberry.widgetcache" required="true" version="1.0.0.0"/>
  <feature id="blackberry.media.camera" />
  <feature id="blackberry.ui.dialog" />

  <!-- PhoneGap API -->
  <access subdomains="true" uri="file:///store/home" />
  <access subdomains="true" uri="file:///SDCard" />
  <access subdomains="true" uri="file:///accounts/1000/shared/photos" />

  <!-- Expose access to all URIs, including the file and http protocols -->
  <access subdomains="true" uri="*" />

  <access subdomains="true" uri="http://www.waterhobo.com" />

  <icon rim:hover="false" src="resources/icon.png" />
  <icon rim:hover="true" src="resources/icon_hover.png" />

  <rim:loadingScreen backgroundColor="#000000"
                 foregroundImage="resources/loading_foreground.png"
         onFirstLaunch="true">
  <rim:transitionEffect type="fadeOut" />
  </rim:loadingScreen>

  <content src="index.html" />

  <author href="http://www.msn.com/" rim:copyright="Copyright 1998-2012"></author>  

 <rim:orientation mode="portrait" />

 <rim:permissions>
   <rim:permit>use_camera</rim:permit>
   <rim:permit>read_device_identifying_information</rim:permit>
   <rim:permit>access_shared</rim:permit>
   <rim:permit>read_geolocation</rim:permit>
  </rim:permissions>

 </widget>

有人有任何想法吗?

由于

1 个答案:

答案 0 :(得分:0)

看起来它还没有得到支持。

https://groups.google.com/forum/?fromgroups#!topic/phonegap/XgbWEh3ekUY

我也需要这个,所以我写了这个现在正在为我工​​作的插件:

https://github.com/rsweny/ChildBrowser-plugin-for-BlackBerry

你想要的部分是blackberry.polarmobile.childbrowser插件中的.uploadFile。