And then visualize it PhoneGap/Cordova download file to the device

I'm doing a magazine app that downloads images to the device for the magazine can be read when offline or with a bad internet connection.

I use PhoneGap/Cordova version 3.1 with 10 of BlackBerry and plugins file and file transfer. I made a few changes to my code base that runs on Android and iOS since before he could download files on the Simulator. Ensure the directory that I wanted to save the file to exist and access to the file with the path indicated in fs.root.toURL ().

But now that I got the files uploaded to the device I can't view. On other platforms, I was able to use theFileEntry.toURL () and set it as the source for an img tag. But for BB10 I see only an empty img tag. =/
The specified local path is: filesystem:local:///persistent/bblogo.png

I was searched and seen references to disabling sandbox and by saving the file on blackberry.io.shared or blackberry.io.home, but blackberry is not available for me with PhoneGap 3.1. Looking at the native documentation , that I saw that the shared path is/accounts/1000/shared but trying to browse the file system I am told that the path does not exist. (fs.root.getDirectory ('accounts') to start with).

I have a GitHub repository with what I'm looking for here: https://github.com/gaqzi/phonegap-bb10-file-transfer-test
The code in question is here: https://github.com/gaqzi/phonegap-bb10-file-transfer-test/blob/master/www/js/index.js#L38

I also noticed that the size of the file when the download is complete is much larger than the actual size of the file on my computer. And the same code running on iOS I see not enough to increase the size of the file. I don't know if that has to do any.

To try to combat the current file size wildly different I coded an image 10 x 10 pixels as Base64, she decoded on the device and saved. Now, he pointed out the same size on my computer and the device, but still can not see. The same exercise done on iOS gives me a visible image.

For the code on the test of Base64, please see my thread Stack Overflow for this: http://stackoverflow.com/questions/19421245/blackberry-10-cordova-phonegap-3-1-filetransfer-image-do...

I am at a loss what can I do to access the files I created, anyone has an idea?

Hello

The patch for the cordova file api is still ongoing. Until that of land, here is an example for download of an image and inject it into the DOM. It uses XHR, but the filetransfer plugin should work as well.

https://gist.github.com/jeffheifetz/c1127b4d3e132ffff972

You will need to 'blackberry.io', which is available as plugin PhoneGap/Cordova here:

https://github.com/BlackBerry/Cordova-BlackBerry-plugins/tree/master/plugin/com.BlackBerry.IO

The patch will automatically update toURL so that it returns the full path which has been hard-coded in the example.

Tags: BlackBerry Developers

Similar Questions

Maybe you are looking for