How To Refresh The Screen Automatically In Mobile Application

Community/Forums/QuestionsUserImage.jpgDileep RajamRank: #43145How to refresh the screen automatically in mobile application2080Views10CommentsSolvedQuestionMobile

Hi Team,

I am new to Outsystems. I am developing a mobile application with a chat functionality embedded in it. I want to refresh the chat screen that i definied automatically for every x seconds. Can you please let me know how can i refresh a mobile screen automatically.

Thanks,

-Dileep

0018 Jul 2018Copy post link2024-08-28 10-01-54Kiran ShindeChampionRank: #319Solution

Hi Venkata RajamVenkata Rajam,

As Kilian Hekhuis said yo can refer the demo on https://www.outsystems.com/forums/discussion/21226/tip-how-to-programmably-auto-refresh-a-mobile-screen/ . But by following this way the screen will get refreshed after every x seconds even if you dont have updated any chats. the best way to do that use firebase notification (https://www.outsystems.com/forge/component/1406/firebase/) component so that you can notify screen when the chats updates and on notify using firebase receiver you can refresh the chats. to do that follow the link to configure firebase https://www.outsystems.com/forums/discussion/25871/how-to-configure-the-firebase-plugin/

See solution in context2019 Jul 2018Copy comment link
2020-09-15 13-07-23Kilian Hekhuis MVPRank: #4

Hi Venkata,

What do you want to refresh? Do you display data, and you want to refresh the query? Or do you want to call a REST service every X seconds? Or what?

Anyway, the way to do it is via JavaScript: call setInterval with a function body calling a Screen Action. Don't forget to clearInterval() in the OnDestroy.

0118 Jul 2018Copy comment link
UserImage.jpg1 reply18 Jul 2018Show threadHide threadUserImage.jpgDileep RajamRank: #43145

Kilian Hekhuis wrote:

Hi Venkata,

What do you want to refresh? Do you display data, and you want to refresh the query? Or do you want to call a REST service every X seconds? Or what?

Anyway, the way to do it is via JavaScript: call setInterval with a function body calling a Screen Action. Don't forget to clearInterval() in the OnDestroy.

Hi Kilian,

Thanks for response. As i mentioned i had embedded a chat functionality using In-App Chat mobile forge component and i want to make this realtime. Currently every time i send a message in my chat screen, i had to go back and come back to see the updated chat responses.

So i thought if there is a way to achieve this by refreshing this chat screen automatically without i clicking something.

I tried creating a button and set its display property to none and a click event to call back the screen. Now i want to get this click event triggered automatically.

Can you help me setting up this feature.

0018 Jul 2018Copy comment link
2020-09-15 13-07-23Kilian Hekhuis MVPRank: #4

Hi Venkata,

I explained above: use a setInterval() in the OnReady, and a clearInterval() in the OnDestroy. Like in this topic (even though the poster didn't quite get it right yet).

0018 Jul 2018Copy comment link
UserImage.jpg1 reply18 Jul 2018Show threadHide threadUserImage.jpgDileep RajamRank: #43145

Kilian Hekhuis wrote:

Hi Venkata,

I explained above: use a setInterval() in the OnReady, and a clearInterval() in the OnDestroy. Like in this topic (even though the poster didn't quite get it right yet).

As you mentioned, i created OnReady Event in which i called in a JS with setInterval() and redirect to the chat screen after every 10sec and a clearInterval() in OnDestroy event.

I am getting error "Too many Redirects" as shown below

0018 Jul 2018Copy comment link
2020-09-15 13-07-23Kilian Hekhuis MVPRank: #4

Hi Venkata,

You should redirect to the screen, because that will indeed cause the "too many redirects". Instead, you should just refresh the query getting the chats, or the REST service retrieving the chats, and update the list that feeds the chat component. In Mobile Apps, if you refresh/change data bound to a Widget, the Widget refreshes automatically (for Blocks you need the handle OnParametersChanged).

0019 Jul 2018Copy comment link
2024-08-28 10-01-54Kiran ShindeChampionRank: #319Solution

Hi Venkata RajamVenkata Rajam,

As Kilian Hekhuis said yo can refer the demo on https://www.outsystems.com/forums/discussion/21226/tip-how-to-programmably-auto-refresh-a-mobile-screen/ . But by following this way the screen will get refreshed after every x seconds even if you dont have updated any chats. the best way to do that use firebase notification (https://www.outsystems.com/forge/component/1406/firebase/) component so that you can notify screen when the chats updates and on notify using firebase receiver you can refresh the chats. to do that follow the link to configure firebase https://www.outsystems.com/forums/discussion/25871/how-to-configure-the-firebase-plugin/

2019 Jul 2018Copy comment link
2017-11-07 08-23-52Furkan ÇetinRank: #894

Hi,

Use web sockets instead of refreshing every second. For a chat application are web sockets the best way to post and get data. In the Forge you can find components to implement web sockets in your app.

Regards

0019 Jul 2018Copy comment link
2024-08-28 10-01-54Kiran ShindeChampionRank: #319

Hi Furkan Çetin ,

I am also suggesting the same thing by using firebase (Inside firebase the communication will be on web sockets).

0019 Jul 2018Copy comment link
2018-04-14 22-30-16Claudio LichtRank: #57436

How is this different in a Reactive application ???

All I want to do is do a localtion.reload() every 5 seconds ...

I have a javascript with just this line: (I tried in the onInitialize, and the onReady)

$parameters.timeout=setTimeout(location.reload(),5000);

and an onDestroy with clearInterval($parameters.timeout);

...

But the effect I see is a constant refresh iteration caused by the onReady or the onInitialize ...

What is the best way to set this so that I prevent the immediate reload but only do it every 5 seconds?

Where/How should this code be placed?

THANK YOU!

1028 Apr 2020Copy comment link
2020-09-15 13-07-23Kilian Hekhuis MVPRank: #4

Hi Claudio,

Since this topic is already quite old (almost two years), and since your question is about Reactive Web, not Mobile, please create a new topic with your questions, thanks.

0028 Apr 2020Copy comment link
Post ClosedTry OutSystems nowGenerate an App with AI Loading...

Tag » How To Refresh An App