ios - Preventing iPhone app for inactive state -


i need screen on/off callbacks , voice call callbacks. receiving callbacks when app in foreground. unable delegate callbacks when app in background. how possible block or delegate callbacks while app in background?

i read through apple document http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/managingyourapplicationsflow/managingyourapplicationsflow.html

and found "backgound execution , multitasking" http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/managingyourapplicationsflow/managingyourapplicationsflow.html#//apple_ref/doc/uid/tp40007072-ch4-sw20

but nothing helps me issue. please help.

try use uilocalenotification. can register notification in system, , can implement @ specified time.

    -(void) viewdidload{ [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(enteredbackground:) name:@"didenterbackground" object:nil];     [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(enteredforeground:) name:@"didenterforeground" object:nil]; }  - (void) enteredbackground:(nsnotification*)notification{          self.notification = [[uilocalnotification alloc] init];  //set notification property          [[uiapplication sharedapplication] schedulelocalnotification:self.notification];       }    }     - (void) enteredforeground:(nsnotification*)notification{                    //do  [[uiapplication sharedapplication] cancellocalnotification:self.notification];         }     }  

in appdelegate.m

    - (void)applicationdidenterbackground:(uiapplication *)application {             [[nsnotificationcenter defaultcenter] postnotificationname:@"didenterbackground" object:nil]; }  - (void)applicationwillenterforeground:(uiapplication *)application {     // called part of transition background inactive state; here can undo many of changes made on entering background.     [[nsnotificationcenter defaultcenter] postnotificationname:@"didenterforeground" object:nil]; } 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -