Welcome! Log In Create A New Profile

Advanced

[WM26] BACKGROUND ACTVITY

Posted by ISO 
ISO
[WM26] BACKGROUND ACTVITY
June 01, 2022 09:13AM
Hi

I have an app created in windev mobile 26. I need it to save its longitude and latitude coords in an HyperfileSQL database every 1 minute

which i can do fine apart from when the user opens another app or locks the screen after a couple of minutes it stops saving due to loosing connection, i have looked at backgroundtaskadd but this has a minimum interval time of 15 mins. I have thought about saving to local database then syncing when the connection is open again, but the customer wants to be able to see them in realtime.

How can i get the connection to remain open or automatically reconnect even when the app is in the background.

thanks

ISO
Re: [WM26] BACKGROUND ACTVITY
June 01, 2022 06:36PM
Hi ISO,

I had a similar job a few years ago and I did not manage to get it working in a relyable way.

As far as I know the OS (both, iOS and Android) reduce the activities of apps running in the background.
Even Backgroubndtaskadd() will not guarantee that it is executed every 15 Minutes.
The OS can reduce the number of calls depending on battery charge level and other factors.

From the help:

The procedure will not be called anymore if the devices switches to "energy saving" mode.
The timeout between two procedure executions will be reduced if the device is plugged and connected to a WiFi network.
The frequency at which the application is enabled by the user will impact the call frequency of procedure.
The faster the request execution is, the shorter the time between two executions. In most cases, a long execution time of procedure means that the calls will be spaced out in time. The system gives priority to the procedures that consume less CPU.


See also this link: [developer.android.com]


I think this is the reason while Apple and Google implemented a special interface to corona warn apps, to make background tasks reliable for special needs.

What could be a workaround: You can send (AFAIK Android only) silent push messages. This silent pish message is not visible to the user, but can call a procedure which is run immediately after receipt of the push message.

Regards

Stefan.
Re: [WM26] BACKGROUND ACTVITY
June 05, 2022 07:14PM
Hey ISO,

Sorry - I got excited and didn't read the whole response... was going to suggest using the background task functions and it won't let me delete the post.

It seems non-sensical to limit the interval time to 15 minutes!

There's this, but it only works with HFSQL C/S databases according to the help...
[doc.windev.com]

Regards,
Darren.



Edited 3 time(s). Last edit at 06/05/2022 07:23PM by DarrenF.
ISO
Re: [WM26] BACKGROUND ACTVITY
June 10, 2022 10:57AM
Thanks for your help Darren and Stefan

i am having to use a local database with geoTrackingProcedure and

using background task and silent push to reconnect and sync to HFSQL.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: