Pause or complete a client action when mobile screen turns off due to screen timeout?

Hi,

I have a mobile app with a client action where I sync user data (mostly images and some form fields) to a non-outsystems backend. Now, this client action may take 2 - 20 minutes depending on how many images the user is syncing. if the screen turns off due to idle mobile, I see the client action raises an exception and exits. Is there any way I could pause and resume the client action when the user turns on the screen again.

I used the background mode plugin and enabled it at the start of my client action but I still get an exception and exit the client action. Any suggestions on what I could do. Really appreciate any help.

You should implement your own mechanism, with a local entity to store the status of each imagem whether it`s synched or not. So whenever your action starts it takes the next image instead of the first one.

Thanks João. Yes, I got something similar to work. Just would need the user to reinitiate the action again.

On a similar note, would it be possible to keep the sync going in the background when the screen times out or the user moves the app to the background? I'm pretty new to mobile development so any leads in the right direction would help.


Thanks.

As far as I know, the BackgroundMode plugin is supposed to prevent this situation. Try to post a question in the component support page, and see if the owner can help you with it. It might be caused by a bug in the component.

Another approach I personally advise when syncing images is to compress it before sending it over to the server. There is a couple components in the Forge that can help you on it.