Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect what triggered applicationWillResignActive?

I have a Video Chat application that I want to disconnect from a call when the device is locked, but stay connected when an SMS, calendar, low battery or any other type of notification is received. The problem is, I cannot figure out for the life of me how to determine what causes my app delegate's applicationWillResignActive selector to be called.

I have thought about implementing some kind of timeout where if applicationDidBecomeActive was not called within a certain number of seconds I would disconnect but that falsely assumes that a user will ignore or accept a received notification within that number of seconds.

Can anyone help me figure out a way to determine what caused the applicationWillResignActive selector to be called?

Many Thanks, Mason

like image 614
jmason Avatar asked Jul 21 '11 17:07

jmason


People also ask

Will Resign active IOS?

A notification that posts when the app becomes active. A notification that posts when the app enters the background. A notification that posts shortly before an app leaves the background state on its way to becoming the active app. A notification that posts when the app is no longer active and loses focus.


1 Answers

I think the short answer may be, that you can't really determine specifically what causes the resign call, however you can only plan according to if it actually goes in the background or not.

Check this link out where it details the steps multitasking takes.

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

Good luck, you seem like an awesome guy!

like image 139
James Hall Avatar answered Sep 23 '22 00:09

James Hall