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