mergBgTask

Typelibrary
DictionaryLCS
LibraryLiveCode Script
Associationsmergbgtask
Description

mergBgTask is an iOS external that adds commands to start and stop background tasks on iOS. Background tasks allow your app to continue executing code while in the backgound. This external should be considered experimental as it invloves letting LiveCode go into a suspended state rather than quit which is currently unsupported by LiveCode. Your background tasks should not be blocking so that you can handle the mergBgTaskExpired message appropriately to start a new task if neccessary. Use mergNotify notifications from UIApplication such as UIApplicationDidEnterBackgroundNotification and UIApplicationWillEnterForegroundNotification to determine if your task is running in the background and therefore shouldn't do unnecessary things like update the UI (even though I have done that in the demo). mergBgTask requires UIApplicationExitsOnSuspend to be set to NO in the application plist.

TypeNameSummarySyntax
commandmergBgTaskStart

Start a background task

mergBgTaskStart

- - -mergBgTaskStop

Stop a background task

mergBgTaskStop <pBackgroundTaskIdentifier>

functionmergBgTaskCurrentState

This function returns the current state of the application

mergBgTaskCurrentState()

- - -mergBgTaskTimeRemaining

This function returns the amount of time the application has to run in the background before it may be forcibly killed by the system

mergBgTaskTimeRemaining()

librarymergBgTask

mergBgTaskTimeRemaining()

messagemergBgTaskExpired

Sent to the object that called mergBgTaskStart when the background task expires

mergBgTaskExpired <pBackgroundTaskIdentifier>