170
Views
7
Comments
Solved
How to automatically reload a Mobile App?
Question

Hey ,

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


2019-06-15 21-39-22
Afonso Carvalho
Ā 
MVP
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.

2019-06-15 21-39-22
Afonso Carvalho
Ā 
MVP

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.

UserImage.jpg
PatrickĀ  Eiden

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?

2019-06-15 21-39-22
Afonso Carvalho
Ā 
MVP

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.

UserImage.jpg
PatrickĀ  Eiden

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.


2021-10-06 17-41-40
André Rodrigues

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Ʃ

2019-06-15 21-39-22
Afonso Carvalho
Ā 
MVP
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.

UserImage.jpg
PatrickĀ  Eiden

Got it! 

Thank you guys !



Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.