5 Replies Latest reply on Dec 23, 2016 11:19 AM by kerrishotts

    download xml from web

    ppld

      Hello,

      I develop an app with cordova for android,

      and I would like to download an xml file to make it available offline without any intervention from the user.

      This file is available online.

       

      If you can help me...

       

      thank you

        • 1. Re: download xml from web
          VectorP Level 4

          In that case you would:

          - include the whitelist plugin in your config

          - whitelist the external file's location

          - wait for the deviceready event to fire

          - then perform an ajax request for the xml data

          - parse and display as desired

          1 person found this helpful
          • 2. Re: download xml from web
            ppld Level 1

            thank you but after the file is available offline?

            • 3. Re: download xml from web
              VectorP Level 4

              Well, if you want that file to be available offline, why don't you include it in your assets?

              If you want it to be always the latest version, it shouldn't be stored offline.

               

              However, if you don't care what version of the file is kept on the device AND you don't want it to be the initial version that came with the package (which seems a strange requirement to me) then you could store the xml file locally using the file plugin OR in localStorage (whichever you prefer) and retrieve it from that local storage location whenever the user's device is offline.

              • 4. Re: download xml from web
                ppld Level 1

                I develop an app who must be used in off line area and I should update some info every days

                so i need to stock xml and jpg in the phone automatically

                • 5. Re: download xml from web
                  kerrishotts Adobe Community Professional

                  If you need the file offline, save it to your device's persistent storage (Use the File API or File Transfer plugin). Then, when your user is online, check for new data and update your local copy as necessary.