siva
siva

Reputation: 251

multitasking in ios 4 later for notifications

i want to run one of my services in the background even my app is in foreground or background states,if i get any data from that service i want to show that one as a notification to the user. how can i proceed . as my reserach gives me an idea to follow multi taking in iphone .

or shall i use any timer so that the method calls for particular time interval for every time

 NSTimer *timer = [NSTimer timerWithTimeInterval:1 target:self selector:@selector(notification) userInfo:nil repeats:YES];
[timer fire];

   -(void)notification
   {


       //shall i write all of my services here 

    }

or shall i create any new threads like

 [self performSelectorInBackground:@selector(notification) withObject:Nil];

in AppDelegate file . or shall i need to follow any other thing plz guide me thank you.

Upvotes: 0

Views: 60

Answers (1)

Jesse Rusak
Jesse Rusak

Reputation: 57168

Generally, you should consider using push notifications sent by the server to show notifications to the user when something changes. This is preferable to running in the background since it is better for system performance & battery life.

Upvotes: 1

Related Questions