I have set up an app that is registered for remote notifications.
- (void)application:(UIApplication*)application
didReceiveRemoteNotification:(NSDictionary *)userInfo
{
NSString *status = [NSString stringWithFormat:@"Notification Received:\n%@",userInfo.description];
NSLog(@"%@",status);
UIAlertView *alert=[[UIAlertView alloc]
initWithTitle:@"didReceiveRemoteNotification"
message:eventName
delegate:self
cancelButtonTitle:@"Hide"
otherButtonTitles:@"View",
nil];
alert.tag = kAlertTypeNotification;
[alert show];
[self vibrate];
if ( application.applicationState == UIApplicationStateActive ) {
// app was already in the foreground
**DO SOMETHING HERE**
}
else {
// app was just brought from background to foreground
}
}
So, when the app is not active, i get that really nifty banner alert, that looks so nice on the iPhone.
However, when the app is open, the only option I seem to have is to present a UIAlertView. This is intrusive in my opinion. Is there a way I can display the banner while application.applicationState == UIApplicationStateActive? Or, is there an open source library that implements this kind of feature?
Thanks for all your help!
You can do whatever you want when the app is in the foreground. Who says you have to display a UIAlertView?