339
Views
4
Comments
How to call a Server action when the user kills the app
Question

Hi All,

I am building mobile application that has a requirement to call a server action before killing it.

Scenario

1. User Kills the mobile app

2. The application will call a server action first to update a data before the app will close / killed completely

Is there an outsystems built in function that I can use to catch the kill event? something like OnClose?


Thank you

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Hi Paul,

On a mobile screen you can attach a client action to  the OnDestroy event.

In that action you can call the server action.

Regards,

Daniel

UserImage.jpg
Paul Cervin Mitch Villarin

Daniël Kuhlmann wrote:

Hi Paul,

On a mobile screen you can attach a client action to  the OnDestroy event.

In that action you can call the server action.

Regards,

Daniel


Thank you Daniel but the OnDestroy only triggered when the screen is closed and not the whole App. Do you think this is possible?

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Is it not that when you close the app, also the screen is closed and thus destroyed?

2021-04-09 11-42-43
assif_tiger
 
MVP

Hi Paul,

I too had faced the same scenario with one of mine project while working in Native App Development. There is no way to detect the App Kill Event on any Platform [ Android / iOS ], sorry.

When a user or the system force stop your application, the entire process is simply killed. There is no callback made to inform you that this has happened.

When your application is killed in the background it is just killed. It is not woken up, and no methods are called on it. It is unceremoniously terminated and removed from memory. You cannot respond to this event. The same happens when the user force-quits your app from the app-switcher.

Thanks,

Assif

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