iOS notification app goes into background doesn't seem to work

Graham Samuel livfoss at mac.com
Fri Nov 20 10:23:00 EST 2020


Thanks to Mark Smith and Henry Lowe, I know that I’m supposed to set up mergNotify for two notifications as below.

I believe I’ve done this, and I’ve set a monitoring action (putting a text into a field) to show that these notifications have happened.

Of course it may be just me, but so far, I only seem to get the notification when the app comes back into the foreground (so logically it must have gone the background first),  but I just don’t get the ‘going in to the background' notification, or at least my monitoring doesn’t work.  Is there some trick of timing that I’ve missed?

Graham


> On 17 Nov 2020, at 20:07, HENRY LOWE via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> <Thanks to Panos for this tip:>
> 
> On iOS use mergNotify as below. Works well for me.
> 
> on openStack
> mergNotify "UIApplicationWillResignActiveNotification"
> mergNotify "UIApplicationDidBecomeActiveNotification"
> end openStack
> 
> on UIApplicationWillResignActiveNotification pUserInfo
> // Your code before the app goes to background
> -- your code here to handle going to the background
> end UIApplicationWillResignActiveNotification
> 
> on UIApplicationDidBecomeActiveNotification pUserInfo
> // Your code after the app comes back to foreground
> -- your code here to handle your app becoming active
> end UIApplicationDidBecomeActiveNotification
> 
> Henry

> 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




More information about the use-livecode mailing list