Anyone know how to clear the application Cache programatically?

39 views
Skip to first unread message

Chris French

unread,
Nov 5, 2016, 12:11:40 PM11/5/16
to mgwt
I am developing a phone app - often, when I make an update the application will not run because data structures have changed and then are now inconsistent with the cache.  Anyone know how I can go about clearing the MGWT application cache programatically?

I can do it manually pretty easily on Android but the only way to do it on iPhone is to delete and re-install the app. Which would be a real pain for my Customers.  What would be great is if I could detect a new version (perhaps by comparing a cookie or something) and then clearing the cache automatically.

Many thanks for any help.

Kind regards

Chris

paul

unread,
Nov 6, 2016, 3:39:57 PM11/6/16
to mgwt
Hello Chris,

I'm not sure what you mean to be honest. I assume you are using html5 application cache so your application works offline.

Are you talking about inconsistencies arising when your application talks to the server?

If you give me a clearer example how your application is structured then I maybe able to give you some pointers.

Chris French

unread,
Nov 7, 2016, 4:08:52 AM11/7/16
to mgwt
Hi Paul,

Thanks for getting back to me.  To be honest I am not sure how MGWT handles it's cache - according to the vidoes MGWT somehow maintains an application cache and it seems to be this that is the problem.  I have noticed that if I change any data structures (which I assume will be included in the cache) I get a problem in that the 'application' will not load - I just get a white screen.  If (on Android) I go and clear the Applications cache - all is well.  On IPhone I get the same problem but there is no way to clear the Application cache on an iPhone (at least on v10.x) so the only way is to remove an reinstall the application.
I will see if I can expose an Exception or try to get some more information.

Kind regards

Chris

Chris French

unread,
Nov 7, 2016, 4:30:06 AM11/7/16
to mgwt
Hi Paul,

A bit of an update - I wrapped the application in a try/catch to see if I could get a clue but (typically) when I released it - this time it worked fine.  I guess I am just going to have to keep an eye on it and hope that the try/catch wrapper will give a clue at some time in the future.

Kind regards

Chris

On Sunday, November 6, 2016 at 8:39:57 PM UTC, paul wrote:

Manfred Tremmel

unread,
Nov 7, 2016, 2:38:51 PM11/7/16
to mg...@googlegroups.com
Am Samstag, 5. November 2016, 09:11:40 schrieb Chris French:
> I am developing a phone app - often, when I make an update the
> application will not run because data structures have changed and
> then are now inconsistent with the cache. Anyone know how I can go
> about clearing the MGWT application cache programatically?

You can force a reload using JSNI (elemental doesn't support the
parameter, even if it is documented in the JavaDocs):

public static native void forceReload() /*-{
$wnd.location.reload(true);
}-*/;


The other thing is using REST instead of GWT-RPC, it's more stable when
data structure changes.

--
Machs gut | http://www.iivs.de/schwinde/buerger/tremmel/
| https://github.com/ManfredTremmel
Manfred | http://www.knightsoft-net.de

Reply all
Reply to author
Forward
0 new messages