I need a local notification for an iphone app to pop up while the app is active. Is this possible? If so how?
Local notifications and push notifications are ways for an application that isn’t running in the foreground to let its users know it has information for them. The information could be a message, an impending calendar event, or new data on a remote server. When presented by the operating system, local and push notifications look and sound the same. They can display an alert message or they can badge the application icon. They can also play a sound when the alert or badge number is shown.For detail knowledge see this link Local Notification
You can make a same animation in app.
I made a lib to make an animation almost as same as local notification's.
Check this: https://github.com/OpenFibers/OTNotification
Demo:
And you can post a new message to this lib when you received a message in
- (void) application:(UIApplication *)application didReceiveLocalNotification: (UILocalNotification *)notification
{
OTNotificationManager *notificationManager = [OTNotificationManager defaultManager];
OTNotificationMessage *notificationMessage = [[OTNotificationMessage alloc] init];
notificationMessage.title = [self notificationTitle];
notificationMessage.message = @"A notification. Touch me to hide me.";
[notificationManager postNotificationMessage:notificationMessage];
}
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
is called if you have a notification scheduled and the app is already running..it is a UIApplication
delegate method..
here you can do your custom code..by accessing the notification...
edit :
if you want to present a notification right now .. then you can just set the notification fire date to past...it will be fired..then you can create a alert view in the above given UIapplication method