Hi Everyone. 


Is it possible to change screen variable when application comes from background to foreground ?

I want to show block screen each time application comes from background to foreground. 


Regards,

Anahit 


Solution

Hi,

You can add an event in your layout (On Ready):


document.addEventListener("resume", $actions.TriggerOnResume, false);

The action TriggerOnResume should launch an event:


And when you receive this event you can change the content of the screen and show your block.


Additionally it is good practice to remove the event in ondestroy:


More about cordova events:

https://cordova.apache.org/docs/en/latest/cordova/events/events.html


Solution

bfcantante wrote: Hi . Thank you very much for your help. it works.

Hi,

You can add an event in your layout (On Ready):


document.addEventListener("resume", $actions.TriggerOnResume, false);

The action TriggerOnResume should launch an event:


And when you receive this event you can change the content of the screen and show your block.


Additionally it is good practice to remove the event in ondestroy:


More about cordova events:

https://cordova.apache.org/docs/en/latest/cordova/events/events.html




Hi 

If i write document.addEventListener("resume",$actions.OnResume,false) in onReady and document.removeEventListener("resume",$actions.OnResume,false) in onDestroy i am getting unknown actions. Please let me know where i am doing mistake.

Thanks

Harish

how to use it ., i installed it and tried to drag the onResume component but unable to add. And also i don't have any ui change i need to perform action.

bfcantante wrote:

Hi,

Try: https://www.outsystems.com/forge/component-overview/3408/mobile-events

Regards.