27 Sep 2012 1:16 AM #1
Unanswered: DataItem; given an url download file on tap
Given an url is it possible to download the file by taping on a DataItem?
I have searched through forums and none of the suggestions proposed have worked so far. I'm developing on Android 2.3.6 platform.
window.open() doesn't work and almost any other solution I tried works on my workstation but not on the smartphone.
Any suggestion on how can I do this? Is this issue contemplated or addressed in any future release of Sencha Touch?
Thank you very much.
Last edited by arael78; 28 Sep 2012 at 1:23 AM. Reason: grammar and spelling
29 Sep 2012 7:50 PM #2
- Join Date
- Mar 2007
- Gainesville, FL
- Vote Rating
location.href to the file should trigger the download.
Sencha Inc, Senior Software Engineer
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services email@example.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!
When posting code, please use BBCode's CODE tags.
2 Oct 2012 12:34 AM #3
Thank you for the suggestion. Unfortunately this works only for txt, html and image files. Most of my contents are pdf, docs, ppt, and zip files. And the location.href doesn't work with these files.
Another problem is that the opened files are then visualized fullscreen but no user interaction is possible. The user cannot save the file. He/She can only go back and when he/she does the application is reloaded or the application exists.
Is it possible somehow to perform and ajax call, setting some cookies and download the content locally on the sdcard? Then once the file is downloaded I would need to open it by starting an external application.
That would solve a major problem in my app.
2 Oct 2012 11:09 PM #4
This is a new feature of Sencha Touch 2.1 (device.openUrl) - However, I've been unable to get it working with the betas/nightly.
Forumposts states that the feature it self should be working now, but the building of a native app is notSven Tore Iversen
10 Oct 2012 5:26 AM #5
Right now I'm using the PhoneGap FileTransfer function. It works well but there is the problem of opening the file once it is downloaded.
I'm trying to find a way to open the file with external applications to widen the support to file formats such as zip, ppt, odt, doc, mp4, ecc.