Hey ,

is it possible to automatically reload a Mobile App after a certain amount of time?


Hi Patrick,

What do you mean when you say "reload" the mobile app? Do you mean you want to refresh a page automatically? You could do that by periodically clicking a hidden button with Javascript.

Do you mean you want to trigger your Sync process? You'd have to call it yourself in an interval, probably in a similar way.

Do you mean you want to refresh a page automatically?

Yes! 


So i need to create a button. Where do i have to put the Javascript? I guess to ne screen im using the button with?

I'd create a hidden button and give it a unique class to be able to select it in the Javascript a little easier:

Put the "display:none" inside the CSS tab associated with your class - the inline style is just to make this easier to screenshot.

Then on the OnReady of the screen, or whatever method you want (as long as the screen has already loaded), you could put a Javascript block and write something like this:

setTimeout(
    function() {
        document.querySelector(".RefreshButton").click();
    },
30000);

And this would click your button every 30 seconds (its expressed in milliseconds), invoking the action associated with it - you can do whatever you need in there.

Afonso Carvalho wrote:

I'd create a hidden button and give it a unique class to be able to select it in the Javascript a little easier:

Put the "display:none" inside the CSS tab associated with your class - the inline style is just to make this easier to screenshot.

Then on the OnReady of the screen, or whatever method you want (as long as the screen has already loaded), you could put a Javascript block and write something like this:

setTimeout(
    function() {
        document.querySelector(".RefreshButton").click();
    },
30000);

And this would click your button every 30 seconds (its expressed in milliseconds), invoking the action associated with it - you can do whatever you need in there.


Thank you ! i just added a button referencing to the currentScreen and a client Action mit the Javascript in it.

The Question is: where do i reference the Refresh Action? So that the script is executed.


Hi Patrick,


As mentioned above you can do it using JS, but without need to add a button to the page.

Simply create the RefreshAction and on the OnReady of the page use the following JS:


setTimeout( function() { $actions.RefreshAction
    },
30000);


Cheers,

André

Solution

Use it in the button. The button will invoke it every time it gets clicked.

Edit: André makes a good point! I forgot you can call client actions directly in mobile. Call the action directly with that syntax instead of the button.

Solution

Got it! 

Thank you guys !