Clear mobile cache

Clear mobile cache

  

The problem that i am having is the following, and is related to OutSystems Mobile, and lets assume that the problem in question involves office deparments areas:


1-

I am in a mobile screen, that has an input parameter as non mandatory, and let's say that is the Id of a certain office department area. This screen presents a list will all possible deparment areas. The screen should be completely rendered when the input parameter is Null, but when this is not Null the user should see the page being rendering and then immediately go to the office department area detail screen. 

The problem that i have is when the input parameter is not Null. The redirect to the office department area detail works well, however when i do a go back on this screen (e.g. via back button in android or via a back button in the screen that links to previous screen) i would want to go back to the screen with the list of all office department areas but that does not happen. What happen is that when going to previous screen the input paramenter is still filled, that leads to a redirect again to the office department area details screen. 

Already tried to clean the input paramenter immediately before doing the redirect in the office deapartment areas list screen, and also via the "On Destroy" event of this this.


2-

Other problem is the following. Imagine the list of office department areas (pulled via the action "Fetch data from other sources" and then assign to a local variable), and this list shows what were the areas that the user already have seen it's details or not. When a user clicks on a office department area that he haven't seen yet, this will be marked as seen, however when the user goes back to previous screen (e.g. via back button in android or via a back button in the screen that links to previous screen), the list will be not updated and the already seen office department area will show up as not seen. This leads to the conclusion that the "Fetch data from other sources" are not run again.

Already tried to update the "seen status" in the office depatment areas list (local variable) before the redirect to the details screen that that does not work.


Hi Rui,

are you testing these scenarios on Android/iOS devices or via the Chrome simulator?

Mobile navigation patterns have their own documentation page, you may be able to use it to customize its behaviour (I'd check what you can achieve with navigateTo or navigatedFromHistory).

You may also want to check this post on a related scenario.

Jorge Martins wrote:

Hi Rui,

are you testing these scenarios on Android/iOS devices or via the Chrome simulator?

Mobile navigation patterns have their own documentation page, you may be able to use it to customize its behaviour (I'd check what you can achieve with navigateTo or navigatedFromHistory).

You may also want to check this post on a related scenario.

Hello Jorge,


First of all, thank you for your reply. Currently i am testing in the chrome simulator and I had already seen the forum posts and tools that you posted. I had not tested yet because because it will be a considerable effort from the get go, and I was wandering if the platform already had some mechanisms to handle the questions: 

1 - erase the input variables of the screen when going to another (in some cases this is useful and others not) 

2 - when loading a screen go to cache and other times just load again (in some cases the first is usefull and others the last one is what we want)


However from your reply it seems that there is not already built in, or that require additional dependencies (e.g. cordova, ...)

 

Thanks in advance

Rui,

When you using the simulator and the browser's back button, browsers tend to fully cache pages, so they will not even send the request to the server again...

Regarding 1) you can end your screen action with a navigate tool, to the same screen, and you will be able to specify what the inputs should be. Regarding 2) the cache is done by the browser, you can add headers to the response (or <meta> tags to the <head> of your page) if you want to make sure that the browser doesn't cache that particular page.

For mobile apps, I'd strongly advise trying the Navigation API first, it appears to be able to do what you need and, as far as I know doesn't rely on Cordova so it should also work on the Chrome simulator.


Jorge Martins wrote:

Rui,

When you using the simulator and the browser's back button, browsers tend to fully cache pages, so they will not even send the request to the server again...

Regarding 1) you can end your screen action with a navigate tool, to the same screen, and you will be able to specify what the inputs should be. Regarding 2) the cache is done by the browser, you can add headers to the response (or <meta> tags to the <head> of your page) if you want to make sure that the browser doesn't cache that particular page.

For mobile apps, I'd strongly advise trying the Navigation API first, it appears to be able to do what you need and, as far as I know doesn't rely on Cordova so it should also work on the Chrome simulator.


Jorge,


Once again, thanks for your reply.


Already tried on the device and it also happens, so it's cross platform, it's related to cache and the way that works. 


Regarding your sugestion to issue number 1, previously I thought on that solution but it would not solve the problem if the going back was done via android button, and in order to override the android button i would need a extra dependency to a cordova plugin (the one that you said in the first reply).


The cordova dependency that i said previously was not regarding the Navigation API but related to the cordova plugin that we need to use in order to override the default behaviour of the back button on android.


Regarding your sugestion to the issue number 2 I never thought about that. I already gave it a try, by inserting the 3 following meta tags (via the method "AddMetaHttpEquivTag" of the HttpRequestHandler module):

<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />

<meta http-equiv="Pragma" content="no-cache" />

<meta http-equiv="Expires" content="0" />

(source: http://cristian.sulea.net/blog.php?p=2014-01-14-disable-browser-caching-with-meta-html-tags)

At the end this haven't solved the problem regarding issue number 2, maybe because it's mobile and/or other reasons.