Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Highlighted
Developer
Posts: 111
Registered: ‎10-01-2009
My Device: Not Specified

trouble with widget/application cache on device

I am unable to refresh/reload a web widget i am working on on my physical device (9930, running 7.1.0.163). For testing purposes, i am using a remote source [http://server.index.html] for the content. After installing the widget on the device, i can't get that main/index page to change.
Ideally, I want to have the remote content source (for testing), and allow the device to cache certain files. So i have been playing around with manifest files and the cache settings in the config.xml file, so I think i did something wrong to cause this.
My index file is a basic structure file, and when it loads i load in the real content (start.html) using javascript. The idea would be that only the index.html file and SOME javascript files are cached, and that the other files can be changed without a problem. Unfortunately, i made a small change on the index.html file, and no matter what, it wont update.
Things i have tried:
- deleting app, reinstalling it
- deleting app, changing config.xml to point to a different page (like "http://server/index.shtml?ver=1234"), repackaging with same name and version, reinstalling ... this works at first, but when i change it back to the original "index.html" name, the old cached version is back
- used '<rim:cache disableAllCache="true" />' in the config.xml
- removed the manifest tag in <html>
- tried window.applicationCache.update();
- tried blackberry.widgetcache.clearAll()
- tried blackberry.widgetcache.clearCache()


In ripple and/or the simulator, this all works fine. the correct things appear to be cached, and the updates are updated. I think the only thing left to do on my physical device is to do a full wipe, but if thats the case, it will make testing on a physical device much more complicated. Maybe theres a better way for me to be testing this on a physical device, using a remote source, allowing for caching of certain files but also allowing for immediate updates to my test pages?

Thanks for any advice.

Retired
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: trouble with widget/application cache on device

Can I suggest adding these to your index.html?  It may be just that the content for your file is 'stuck' in cache, and I'm hoping the following may help get it 'unstuck' ?

 

<meta http-equiv="PRAGMA" content="NO-CACHE">

<meta http-equiv="CACHE-CONTROL" content="NO-CACHE">

<meta http-equiv="EXPIRES" content="Mon, 22 Jul 2002 11:12:01 GMT">

 

 

Note: you may need to restart the device after doing an uninstall.  Sometimes these apps also get stuck in memory and a simple uninstall & re-install doesn't totally clear out the old content (at least that's what I've seen).

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Developer
Posts: 111
Registered: ‎10-01-2009
My Device: Not Specified

Re: trouble with widget/application cache on device

Nope ... no luck. doesnt matter if i delete the app, reboot, then reinstall ... the old index file still shows up.  I have tried rebooting at every possible step, over and over, it doesnt seem to ever help.
The only way I can get it to update is if i use the file manager on the blackberry (or on my desktop when connected by usb), delete any instances of either [device: or sdcard:]/Blackberry/system/appcache/rim/webstorage/myapp, delete the app, reboot.
This only works sometimes, since often it says the file/folder is in use. (why is it in use after ive already closed my app? anyway to force kill whatever thread is using it?)
There must be something in my index.html file, config.xml file, or appcache file thats causing this problem ... or im doing something else wrong. its nearly impossible to get this app to refresh on a device. I would think that regardless of the cache settings (in html file, cache manifest, or config), one of window.applicationCache.update(), blackberry.widgetcache.clearAll(), or blackberry.widgetcache.clearCache() would work no?

 

Retired
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: trouble with widget/application cache on device

Oh I see, you are using HTML5 app cache?

 

This data is saved to persistent storage on the device (Java container).  That would explain why you need to clear out the DB in order to see changes reflected.

 

Going back to having the manifest file added to your page: What happens when you make changes to the *.manifest file on the server side (e.g. updating the date as a comment at the top of the page)?  That should inform the local user agent (in this case the webworks app, it could be the browser too) that a change has happened and the local store needs to be updated.

 

 

Are you able to test this page in the BlackBerry browser?  If so, do you get the same behavior?

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Developer
Posts: 111
Registered: ‎10-01-2009
My Device: Not Specified

Re: trouble with widget/application cache on device

Ok I'm trying to narrow down the problem. So ill walk through what I'm doing now.


First, in config.xml, I set disableAllCache=true.
- This seems to fix the caching problem ... but then again, its not caching anything (even with manifest/appcache enabled). So its not really want I want, but for testing it may work.

 

Now, trying with removing any <rim:cache /> settings from config.xml.
- using manifest/appcache
- ( can I just say, id be complaining about how annoying it is having to reboot the live device for debugging, but this is so much ... less frustrating ... debugging on live 9930 and dealing with the reboot time then it used to be. It used to take 5-10 min for a reboot of older models).
- now I'm getting the index page from way before (before my disableAlLCache test)
- it refuses to update, regardless of what i try
- unable to delete webstorage files from device, it says its in use
- plugged into a computer, able to delete the files
- run widget again, and the index is updated
- update index file again
- try to refresh web widget, no luck
- so without any cache settings in config, using manfiest, there's no way to refresh unless I go in and delete the files from the file system

 

Now, trying with removing any <rim:cache /> settings from config.xml.
- NOT using manifest/appcache
- the only thing that works to refresh the page here is blackberry.widgetcache.clearAll();

 

So ... it appears that maybe i should not use the manifest/appcache, and just use blackberry widgetcache instead? although that will still mean it will have to re-download all of the js and resources whenever i want to refresh that main page.