How to make a mobile app stay alive in the background?
merakosp at gmail.com
Mon Apr 27 04:24:12 EDT 2020
Just to add to the discussion that one of Graham's phones runs iOS 10.x, so
in this case, if you need your app to continue running in the background,
you do need to build it with 9.5.1 and check the "enable background
execution" checkbox in the iOS settings. However, you will not be able to
submit this build to the AppStore, as Apple no longer accepts applications
that have this key that is added to the plist if you check "Enable
Background execution". Devices running newer iOS versions will allow apps
running in the background anyway, so you do not need this key in the plist
- and this is why this key (i.e. the checkbox) was removed in LC 9.6 DP-3.
So, to conclude, given that you are not interested in submitting the app to
the AppStore, I believe you can include this key to the plist (i.e. check
"Enable Background Execution" checkbox), so your app will continue running
in the background in both old and new iOS devices.
On Mon, 27 Apr 2020 at 10:42, Graham Samuel via use-livecode <
use-livecode at lists.runrev.com> wrote:
> 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 lists.runrev.com> 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.com ~ http://www.livecode.com/
> > LiveCode: Everyone can create apps
> > _______________________________________________
> > use-livecode mailing list
> > use-livecode at lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
More information about the use-livecode