开发者

Problem with background playing

I have a problem in understanding the following methods...I have two works to done. identify when user play home button and second is to ide开发者_运维问答ntify when application was interrupted by phone call.

 - (void)applicationWillResignActive:(UIApplication *)application ;
 - (void)applicationDidEnterBackground:(UIApplication *)application;


You need to implement AVAudioSessionDelegate

There are methods for beginInterruption and endInterruption

By the time the beginInterruption arrives, your audio has already stopped. Your application may be suspended or terminated following an interruption—for example, if a user chooses to take an incoming phone call


Check this

applicationWillEnterForeground vs. applicationDidBecomeActive, applicationWillResignActive vs. applicationDidEnterBackground


See this handy webpage and the flowcharts there:

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

Basically, you don't get told the reason for being backgrounded (phone call versus home button), but in some circumstances you might be able to glean what happened (e.g. appWillResignActive followed by appDidBecomeActive happens when a phone call was refused) -- however I'd be very wary about attaching interpretations to such things.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜