views:

603

answers:

4

In creating an iPhone app, is it possible to generate a popup alert on the iphone (similar to a Push notification) when the app has been closed. A simple example would be to have an app that can set a reminder at 5:00PM January 5th, 2010. The app can be closed and the reminder will popup at that time. I don't think this is possible but would like to know if anyone has any ideas? Again, i do not want a Push solution but rather a solution that does not require internet access (i.e. "local" push from iPhone). Thanks.

+2  A: 

Sorry buddy, not possible.

There might be solutions for a popup when the app is reopened, but not when it's closed and without push.

EDIT: Actually, yes!!, but it's janktacular. You can create an .ical file with let's say, 15 minute alerts, sync it to a caldav/webdav server and have the iPhone subscribe to it in the Mail/Contacts/Calendars settings pane. Check out Omnifocus, this is their push work around. It syncs things that are due to my MobileMe iDisk, and I subscribed to the calendar - Boom, notifications.

nullArray
That is a spectacular hack.
Jeff Kelley
It just came to me - Thanks!
nullArray
A: 

Unfortunately, no. This would require some sort of background processing for your app, and that is not allowed in the current iPhone SDK. Push notifications are the only solution I'm afraid.

If it's an issue of development effort, I know Urban Airship has some solutions to make Push Notifications easier.

Ken Pespisa
A: 

Nope, you'd have to use push notifications. Your app would have to be running to display any alerts.

All the workarounds I can think of would require internet access: add an event to a calendar somehow, or again, use push notifications. urbanairship.com has a pretty straightforward push notification service you could utilize.

jenningj
+1  A: 

You can do it now! And it's really rather simple. Create a UILocalNotification.

UILocalNotification *localNotification = [[UILocalNotification alloc] init];
        if (localNotification == nil)
            return;
//Initialise notification
        localNotification.fireDate = yourDate;
        localNotification.timeZone = [NSTimeZone defaultTimeZone];
        localNotification.alertBody = [NSString stringWithFormat:NSLocalizedString(@"Hey, you've forgotten something", nil)];
        localNotification.alertAction = [NSString stringWithFormat:NSLocalizedString(@"%@", nil), buttonTitle];
        localNotification.soundName = UILocalNotificationDefaultSoundName;
        [[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
        [warningDate release];
        [localNotification release];
Smikey
Oh an import the MessageUI.framework of course :)
Smikey