n00b caching questions

n00b caching questions

Hi,

As the subject says, I'm new to intel xdk and its api's, though not new to web development and javascript (I've developed dynamic sites using tools such as rails, jquery and angularjs).

For my first xdk project, I'm essaying a conventional, web-site newsletter app that I would like to apply live content updates in future and enable optional caching of external resources for off-line borwsing.

I've linked to images and fonts hosted externally on a conventional web server, and this works fine in my test builds.

I'm a little unclear of how caching might work in an xdk-generated app. Is there an 'auto-magic' caching mechanism (such as conventional browsers)?

The "addToMediaCacheExt Method" looks potentially a bit kludgy (the xdk api is unfamiliar to me). For example, how would you handle caching resources that were already downloaded online just by opening the app, rather than requiring a manual re-download for caching purposes? Could this be achieved per directory (including subdirectories), rather than on a per file basis, as the documentation seems to imply?

If anyone who can provide insights or point to documentation, tutorials etc. on this topic, it would be greatly appreciated!

Thanks

 

7 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Thanks.

Is the XDK "javascript bridge" API method an implementation of this: http://html5doctor.com/go-offline-with-application-cache/ or is it something completed unrelated?

I'm not sure, but I believe it is something different. Many of the intel.xdk functions were created as part of the original AppMobi XDK product, much of which preceded some of the recent additions to the HTML5. In addition, the webview that your application runs inside of is dependent on the specific target platform and the version of that target platform. This shows up especially in the Android platforms where the webview continues to be based on some very old code and also has some limitations when compared to the browser. You can get a sense of what's available by checking caniuse (for example: http://caniuse.com/offline-apps), but this only gives you part of the picture.

For comparison, you can always try your code using the Crosswalk for Android build. If things work properly there but do not work properly in the standard Android build it's a good indication that the standard Android webview does not support what you are trying to do. The Crosswalk for Android build replaces the standard webview -- with the limitation that it only works on Android 4.x systems and (today) only supports the Cordova API.

Thanks for your thoughtful reply.

I have posted similar questions on a 'sister' forum, https://forums.html5dev-software.intel.com/viewtopic.php?f=34&t=5364 and traded some private messages with your colleagues there regarding activation of HTML 5 Application Cache in the Intel XDK cordova build scripts. I have had limited and intermittent success in getting this to work in 'Emulation' mode. They believe it may be feasible to get it working also in builds, and I am awaiting in hope the outcome of their efforts. Thanks again.

When my application to go through an update. How do I get the data is not lost? (use WebSQL and localStorage)

There are some "permanent" storage solutions out there, I ran across one in particular that I am having trouble locating again. But this is a good reference for the file I/O plugin that can be used to store small amounts of data permanently on a device: https://github.com/apache/cordova-plugin-file/blob/master/doc/index.md

Leave a Comment

Please sign in to add a comment. Not a member? Join today