facebook

android os: Load PDF File from tablet’s local path

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #351898 Reply

    Mobs
    Member

    MobiOne Version 2.6.3
    OS: Win XP

    Preamble:
    I can’t believe that i haven’t found a solution in the help topics on this site. My solution of my problem seems to be so easy….
    If my question is naive, reagadless of that please give an answer. Thanks in advance.
    I am beginner in Javascript and HTML 5.

    Description:
    I have a lot of PDF files an videos which are stored localy on the android tablet device.
    For example: /sdcard/emulated/0/bluetooth/names.pdf and names.mp4
    The number of files and videos is to big to integrate into the MobiOne app using the wizzard and upload to MobiOne. Much more than 200MB

    Problem:
    I want to use the app to open this PDF files, or start this videos, directly from the local path of the tablet.

    Question:
    How can i solve it?

    #351904 Reply

    Hi Mobs,

    There are quite a few unanswered questions. But, not exactly the easiest task and it will take a fair amount of Javascript coding. If you are doing this on your own device and know the files you will be accessing you can use the PhoneGap File API: http://docs.phonegap.com/en/2.9.0/cordova_file_file.md.html#File

    I know on the forum there are a few examples of how to use it. However, your next hurdle is that you list different file types, so you will have to have some file handling functions, for example, if its a audio file are you going to load it into a player? A video into the video player? PDF, etc.

    If you don’t know the files that will be on the device you will need to get a list of them. There are lots of examples online how to do this like:
    http://geekyfry.com/html5-tech-it/reading-writing-files-from-sd-card-phonegaphtml5javascript/

    That one looks like it passes the files into a div element. To actually do something with the list you will probably want to pass them into an array that you can access, not just look at.

    By passing them into an array you can read the extension and then handle that file type.

    So, you can see why there really is no easy answer, at least not something you can say heres the file, open it.

    I know this probably isn’t the information you were hoping for. My advice to start breaking it down into smaller tasks. Planning your app really well can help solve a lot of these as well.

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: android os: Load PDF File from tablet’s local path

You must be logged in to post in the forum log in