I am creating an application in which I am using push push notification. When my application is in the background, I receive a notification in the form of a banner, but when my application is in the active state, I can show a warning that you received a notification through this code: -
(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { UIApplicationState state = [application applicationState]; if (state == UIApplicationStateActive) { NSString *cancelTitle = @"Close"; NSString *showTitle = @"Show"; NSString *message = [[userInfo valueForKey:@"aps"] valueForKey:@"alert"]; UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Some title" message:message delegate:self cancelButtonTitle:cancelTitle otherButtonTitles:showTitle, nil]; [alertView show]; } else {
but I want to show the notification as a banner. What will I do for this? Please suggest.
Saurabh
source share