How to make a mobile app stay alive in the background?

Graham Samuel livfoss at
Mon Apr 27 03:41:29 EDT 2020

Thanks Jacque and Mark - very interesting! Your messages told me stuff I did not know. mergBgTask looks scary and somewhat unsure of itself, but i’ll try.

What is happening to me is that the app is suspended and effectively stopped when it goes into the background. From this state it can only be relaunched, showing the splash screen which I had to provide to iOS (this is not a card in my stack, just a PNG file insisted on by Apple), so the user does not perceive the app to be resuming, but rather restarting. I want them to see the screen they last saw when the app was in the foreground. Plenty of apps do this - Strava, FitDigits, etc. More importantly they do continue to actually run in the background, so that there are for example no gaps in the sensor records they are displaying, either via Bluetooth (Heart Rate Monitors for example) or direct via the OS (GPS information). I need that facility or my app is dead in the water. I don’t have trouble restoring the  app’s status on a restart, as I keep updating the status and storing it in the cache area of my app - but that doesn’t help with the continuous-monitoring-in-the-background requirement.

BTW, Jacque you said

> You are probably running an older version of LC since that checkbox has been removed recently. 

Perhaps in the latest DP, but it’s there in the latest official version, 9.5.1, at least in Indy, which I use.

Will keep trying.


> On 27 Apr 2020, at 08:48, Mark Waddingham via use-livecode <use-livecode at> wrote:
> On 2020-04-27 07:25, J. Landman Gay via use-livecode wrote:
>> On 4/26/20 4:43 PM, Graham Samuel via use-livecode wrote:
>>> I notice in the Standalone Settings for iOS in LC 9.5.1, a button ‘Background Execution’. If I click it, I get a warning that I don’t really understand which suggests that LC doesn’t officially support the feature. I’m not even sure if this feature is what I need.
>> Basically you have to save the user state repeatedly whenever anything
>> significant changes, in case the app goes dormant.
> You actually need to do this regardless of having suspend/resume messages as there's no guarantee that (1) you will get them and (2) you will be able to execute them long enough to save all current state.
> Both mergBgTask and mergNotify provide features to enable managing the background task feature of iOS, and the suspend/resume notifications though.
> Warmest Regards
> Mark.
> -- 
> Mark Waddingham ~ mark at ~
> LiveCode: Everyone can create apps
> _______________________________________________
> use-livecode mailing list
> use-livecode at
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:

More information about the use-livecode mailing list