Delete Local Storage at On Destroy Mobile Application

Hi


Does anybody know what event or what to use when I close (or Swipe Up) an Outsystems application from a mobile device and delete all local storage in that moment.


Regards,

Romel

Hi,

go to your Mobile device app settings, selecta app and press the button to delete all data.

Or alternatively implement a button in your  app that allows the user to delete all data.  On the button you need a client action that uses to delete all entity CRUD action to delete data for all entities.

Regards,

Daniel

Daniël Kuhlmann wrote:

Hi,

go to your Mobile device app settings, selecta app and press the button to delete all data.

Or alternatively implement a button in your  app that allows the user to delete all data.  On the button you need a client action that uses to delete all entity CRUD action to delete data for all entities.

Regards,

Daniel


Hi Daniel, thanks for your answer. The thing is that I'm looking for an automatic method to accomplish this, I mean if you just close the app. If the user logs out clicking a button I can handle that action to delete local storage. 

Regards,

Romel

Hi Romel,

When you log out this happens, all local storage is cleared, using the CRUD function of each table.

You can try to catch the close event of the app and make CleanAll the tables you want.

Regards,
Nuno Verdasca

Hi Romel,


In my opinion it would be better if you clean information from local storage when the user made an action like login, logout or any else that make sense according to your application context.


Mobile applications have two kind of default events:

System Events: https://success.outsystems.com/Documentation/11/Reference/OutSystems_Language/Platform_Utilities/System_Events/Mobile

Screen or Block Lifecycle Events: https://success.outsystems.com/Documentation/11/Developing_an_Application/Implement_Application_Logic/Screen_and_Block_Lifecycle_Events


You also may check if you can use one of them to clean up your local storage. But be attention to Service Studio warnings when you use them.


Best regards,

Juliano


romel2k wrote:

Hi


Does anybody know what event or what to use when I close (or Swipe Up) an Outsystems application from a mobile device and delete all local storage in that moment.


Regards,

Romel

Hello,


If you really want to do that, why not delete all Local Data in the action OnApplicationResume or OnApplicationReady? It will have the same impact on the app.


Best regards.


Hi Romel,

Your request is quite unusual... The first answer that comes to my mind is: don't use local storage for non-device-persistent data, and use instead the session storage, because by definition is what you need:

"The sessionStorage property accesses a session Storage object for the current origin. sessionStorage is similar to localStorage; the difference is that while data in localStorage doesn't expire, data in sessionStorage is cleared when the page session ends"

This of course, means that you need to use it manually (via JS) and not through the platform magic, but it's fairly straight forward.


Let us know your thoughts.

Cheers,

RG