How can I run an app at a specified time on the iPhone? - 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.

Related

iPhone background operations/daemon with live chat module. Keeping the app alive?

I am building a live chat app for the iPhone, and for this it is necessary to ensure that the operator is online and to keep the flow of data going.
After much search it seams to be only two options for similar kind of behavior;
UILocalNotification, only works if I have some scheduled information notice to be sent
Push Notification, for pushing data to the phone
The problem with push notification seams to be that I cannot ensure that the user is available, or in any way talk with the app without the user re-opening it. This way it seams impossible for me to know if the user is online, to update data in the app without the user having to manually open it, etc.
So, what I ask for, is it in any way possible to keep the app active in the background thus ensuring the operator is online and notify of incoming chat sessions?
Thanks a lot for your help guys!
Unfortunately the answer is no. I take it you mean text chat and not VoIP (which CAN run in the background)? Your best bet would be Push Notifications, as you would not be able to monitor anything from the app itself when it is in the background.

How to use Push Notifications

Regarding push notifications. How do I get the provision from APNS to implement push notifications in to my application. Help me guys.
start from these series
http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12
iOS developers love to imagine users of their awesome app using the app all day, every day. Unfortunately, the cold hard truth is that users will sometimes have to close the app and perform other activities. Laundry doesn’t fold itself, you know :]
Happily, push notifications allow developers to reach users and perform small tasks even when users aren’t actively using an app!
Push notifications have become more and more powerful since they were first introduced. In iOS 9, push notifications can:
Display a short text message
Play a notification sound
Set a badge number on the app’s icon
Provide actions the user can take without opening the app
Be silent, allowing the app to wake up in the background and perform a task
This push notifications tutorial will go over how push notifications work, and let you try out their features...
I followed the steps mentioned in raywenderlich tutorial. It's some what easy to send Push notifications to my iPhone app by using my system as the temporary server(ie, sending the message by running the PHP code from the Terminal window).
But, while going for production and dynamic messages for different users at different time, it's very tough for me to set the service in a server.
So, I go with third party server to send Push Notifications. - Parse.com
Tutorial for how to use that API.
Documentation about the installations of the application.
Here, we have a tag parse.com for questions about this process.

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.

Question regarding iphone allowance of custom notifications

I have an app that I am working on, and part of its main functionality is to alert the user to do something. So even though they aren't in the app, I want to be able to pop up an alert from the app, reminding them to do something. Is that allowed with the iPhone sdk? Maybe it isn't even a big deal at all, but for some reason I was thinking that it would require background processes or something that may or may not be possible. Anyone who has any thoughts about how this would be implemented would be greatly appreciated. Thanks!
Check out the Apple documentation on push notifications. Short of jailbreaking and distributing your app outside the App Store, there is no way to run background processes at this time.
It is allowed through notifications, though you will need a server to actually send the notifications to the user. There is no limit to the number you can send, although the user may very well decide to shut off notifications or delete your app altogether if you are too spastic with them. Make very sure the user understands the notification volume they will receive and agrees to it...
The way the system works is the user gets a notification message (and/or sound) and can decide to open your app or not, as the time of notification.

Can I use Push Notification for this

My app should post some message to Twitter at the end of each day at the time X. App might not be running at this time X, but it still has to post that message. I don't want to bother user by everyday asking to do this task.
Can I use Push Notification to silently (without any alert view popup, sound or anything else) do some task in my app in some constant time everyday even if it's not running?
thx
There are three 'notification' mechanisms you can send via push: alerts, sounds, and badge values. The way the push notification works is that on the phone it launches the app and hands over the 'push payload' to it with those values. Even if you turn off all three mechanisms, the OS will still have to launch your app each time, which means the user will get interrupted.
In short, you can't have a push happen silently. I doubt, from a user-experience point of view that Apple will allow things to happen on the phone without the user getting notified somehow.
No.
You can't schedule things to be run by your app on a non-jailbroken iPhone.
The only solution is to have a separately hosted service somewhere to which you push details from your app and that runs the scheduled updates on your behalf.
To do so silently is not up to you. The iPhone device has a configuration in which each app with a Push mechanism has settings where one can specify if they want alerts or not. If set to yes, the text of the alert is displayed as well.
sounds like you are trying to "wake up" your app at a specific time each day to perform some type of task. from what i understand about the iPhone this is not possible. you cannot create a cron job or something that will fire on a time you specify. you can run this on the server side and then push a notification to the user telling them that the message has been posted to twitter.
if you are on a jailbroken phone i feel confident that there is some way to do this.
Given that push notification requires that your server send a notification, why not skip a step and have the server just send the update directly to Twitter on the user's behalf? You can't use push notification to trigger an automatic task on the iPhone like you're asking - the user must take the step of accepting the notification for anything to happen.
if you really want to do it from the phone, you can just declare a "long term" background task should be covered around here (iphone app programing guide) some where..., that way you never go sleep, and you can do what ever you like... :)