Thursday, March 8, 2012

PhoneGap - Download and open a file (pdf, zip, image...)

In the last week I was looking for a solution to show a pdf using phonegap on android and iPhone. Searching on internet I figured out that a possible solution would be the Phonegap ChildBrowser plugin. This plugin basically open the WebView native component and show the address. After some modification (because i needed to use POST request and https protocol) of this plugin I managed to make it work on iPhone. So I did the same modification to the Android code but this time I was not so lucky. I started to find in the network and I came across the Giovesoft Blog post.

The idea was to download the file trough an http/s connection, saving it to the sdcard and opening it. Here is my version of his code. For the installation you can refere to the Giovesoft Blog post.


Looking forward for you comments! Ciao

No comments: