Suspend in iOS, or when is a mobile app running?

Graham Samuel livfoss at mac.com
Wed Nov 18 05:30:35 EST 2020


Thanks to all who replied on this topic - lots of this is new to me! So far, for me the big thing missing is how to **force** iOS to continue sending messages to the app in the background, or alternatively force iOS itself to ask the user the question when the app calls for location data for the first time. Although I have set the ‘experimental’  setting of Location Authorization Type to ‘Always' in my Sstandalone Application Settings, this  does not seem either to ensure access nor to force the message. Maybe wading around in the iOS SDK documentation will help, though somehow I doubt it.

To repeat myself, I have noticed that the following apps which I have used personally, don’t seem to get the OS to ask a question of the user, and yet they unfailingly continue to process the equivalent of locationChanged messages from the GPS when they’re in the background:

Strava
SityTrail
TomTom GO
GB & Parks

and presumably Google Maps and Apple’s own Maps.

They appear to run (i.e execute code, not just sit in RAM) while in the background.I just don’t know how they do it so consistently. 

It’s frustrating to try to solve a problem that’s obviously been solved many times before, but just happens not to be in the public domain. I am not sure I will live long enough to come out the other side of all this (I’m including the issue of tracking a route taking into account GPS inaccuracies and anomalies), but if I do, I’ll write it up.

Graham

> On 17 Nov 2020, at 23:39, Mark Smith via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> And just a reminder that, under iOS, you’ll have to register to receive a “ UIApplicationWillResignActiveNotification” message, and then write a handler to respond to that (PS only register once in your stack script — I learned the hard way). It’s documented under mergNotify in the dictionary (with credit to Elanor for pointing this out to me when my “on shutdownRequest” handlers were being ignored). 
> 
> Jacque, I believe this is what you are looking for to be notified when you go into the background. I do some db cleanup at that time and it seems to work.
> 
> Mark
> 
> 
>> On Nov 17, 2020, at 6:54 PM, J. Landman Gay via use-livecode <use-livecode at lists.runrev.com> wrote:
>> 
>> Android has always acted like this and now that iOS apps run in the background like Android does, it behaves the same way. At least our problems are cross-platform now.
>> 
>> An app will stay in RAM until the user specifically quits or until the OS needs the memory. When that happens, the OS wipes the app and it effectively shuts down. We get no warning, except for a shutDown message. Android recommends we store the last state of the app and restore it when it starts up again.
>> 
>> I'd love to get a message when the app goes into the background but so far there is none. Storing every little change as it happens seems tedious and wasteful. I haven't had much luck with storing changes on shutdown but it's worth a try, it's been a while since I did it.
>> 
>> --
>> Jacqueline Landman Gay | jacque at hyperactivesw.com
>> HyperActive Software | http://www.hyperactivesw.com
>> On November 17, 2020 9:27:50 AM Graham Samuel via use-livecode <use-livecode at lists.runrev.com> wrote:
>> 
>>> Sorry if this is documented somewhere but I can’t find it.
>>> 
>>> On desktop platforms, LC gives us “suspend” which is fired when the app goes into the background. I seem to be having some problems with iOS, in that when the screen locks (triggered by  user action or a time limit), my app seems to stop getting messages from the OS, so is in some sense suspended. This seems to call for something like “suspend” for mobiles. Does such a message exist?
>>> 
>>> Another thing that happens with iOS apps that use Location Services is that the user is sometimes asked via a popu-up on the screen of the device whether the app should be allowed to use these services when it’s not running. I don’t know what triggers these user messages, nor am exactly certain what ‘not running’ means - presumably if the app has been properly quit, that’s something other than ‘not running’. In the Standalone Settings for mobile, one can set Location Services as being a requirement, but there doesn’t seem to be a setting corresponding to this user choice.
>>> 
>>> Has anyone a clear understanding of all this? I would love to see an explanation.
>>> 
>>> TIA
>>> 
>>> Graham
>>> _______________________________________________
>>> 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:
>> 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:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list