Execute event when iphone application is not active - iphone

I want a timer to keep executing in background even when the application is not active. And depending upon some conditions I want to fire a local push notification. How can I achieve this?
Thanks
Pankaj

it seems that is not possible.
first, you register the local push notification and its fire date when your app is active and you can not do it when your app is not active.
second, when you register a local push notification the iphone os is in charge to fire it and not your app.
third, background activity is permitted only for 3 things - music, VOP and navigation, thats all.
if you can explain exactly what you want to achieve we might try to help you in other ways.
hope it will help
shani

Related

Creating an alarm application for the iPhone

I have an idea for a unique alarm application on the iPhone. But at the moment the only way I can see of initiating the alarm is by leaving the app running all night getting it to poll for the current time. Is there anyway to make an app "wake up" or initiate at a certain time. I know I can use push or local notifications but they require user input before loading my app. Thinking about it I could leave my app on all night, but literally doing nothing (saving battery if not being charged) and then subscribe to a local notification for the alarm itself.
Alternatively, can I make the iPhone run my app when an alarm sounds so I don't have to deal with alarm settings at all?
No, your only option is to use either Local or Push notifications.
I think using event kit framework add event in default iPhone calender.

iPhone - is it possible to "awaken" an app after a certain time?

I was wondering if it was possible to have an "alarm" style app that would run at a certain time? Would the application have to be run and then left open?
I know with multi-tasking on the iPhone 4 a user could open the app and run it in the background. If my original question isn't possible, is it possible to bring an app running in the background back into the foreground after a certain time?
Thank you very much for your help.
Have a look at the new 4.0 feature called Local Notifications. Local and Push Notification Programming Guide
You can use EventKit to put certain alarms. It is however not possible to schedule to launch of your app. You can not bring your app forward like you suggest. You could however send a push notification. The link suggested by Jessedc gives a lot of in-depth information about the use of this.

iPhone - how to be notified of call completion

I'm developing an application that needs to take action on completed phone calls, preferably right after the call ends but minimally once per day.
I've read up on the new CoreTelphony framework, and it seems I can get call events if my app is active, but I don't see how to launch/wake my app when a call ends if my app is not the foreground app. I also don't see how any of the new pseudo-background "modes" would allow my app to listen for these events in the background. Do any of you know how this might be done?
If post-call processing isn't possible, then I'd like to figure out a way to automatically wake my app up once per day, pull all of the call events since the last wakeup, and process them. I know how I might do this with Push or Local notifications, but my understanding is that those require user action to continue; in this case, I just want the processing to happen automatically. Is there a mechanism that would enable this?
Thanks,
Dan
You can't launch your app without user interaction.
Push / Local notifications aren't for this kind of thing, they're for letting the user know about event.
On a non-jailbroken device there is no way to do what you want to do.

Action after app quits?

Im currently working on a timer app similar to apple's default "Clock" utility
but when the user quits, NSTimers no longer seem to have any effect
would I have to use push notifications to alert the user the timer has ended, or is there some other way I can run an action on a timer after the application quits?
thanks in advance
When you app quits, it has ended and there is no way to run code after that point.
You could do something with notifications, but that would be a hack and not very practical. Notifications might not appear. Or have delays. Also, no code is run when receiving a notification. Only when the user decides to open your app after receiving one.

How can I run an app at a specified time on the iPhone?

I'm developing a todo list application. I'm looking for any way to alert the user when a task becomes due, even if the app is not running. Is there any way to set the program to run at a specified time w/out user interaction? Or a way to bring up an alert anyway?
Edit: How can I add an item to the calendar?
No, not until the push notification service gets released.
Your best bet right now is allowing users to add reminders to the Calendar - without the push service, there's no notifications without your app running actively.
As has been made very clear by Steve Jobs himself, the iPhone SDK will NOT support background processes. In addition, there is no API to access the calendar on the iPhone.
If these things are important to you, you should file an enhancement request:
Apple Bug Reporter
But even once push is released, that won't enable you to have the application independently alert the user. You would have to run a server that would push notifications to people once a task is approaching due, which means you would have to have everyone's task list synced to your server.