How to determine what caused applicationWillResignActive?

I have a Video Chat application that I want to disconnect from a call when the device is locked, but stay connected when receiving SMS, calendar, low battery, or any other type of notification. The problem is that I cannot understand how much I can determine the reason why my application will delegate the applicationWillResignActive selector.

I was thinking of implementing some kind of timeout, where if applicationDidBecomeActive had not been called for a certain number of seconds, I would have disabled it, but this falsely assumes that the user will ignore or accept the notification received within this number of seconds.

Can someone help me figure out a way to determine what caused the applicationWillResignActive caused by the selector?

Thanks a lot, Mason

+6
source share
2 answers

I think the short answer may be that you cannot determine exactly what the deferred call is causing, however you can only plan if it really goes in the background or not.

Check out this link for details on multitasking steps.

http://www.cocoanetics.com/2010/07/understanding-ios-4-backgrounding-and-delegate-messaging/

Good luck, it seems a terrific guy!

+5
source

In my case, I stopped the video capture on NSNotification.Name.UIApplicationWillResignActive

Now I use: NSNotification.Name.UIApplicationDidEnterBackground

It does not start when a message arrives, or if someone is calling the capture device.

0
source

Source: https://habr.com/ru/post/893298/


All Articles