I am creating an app which runs in the background, performing operations at certain times. It obviously has a settings page, which is what the user sees when they run the app itself.
How would I go about creating the "behind the scenes" part of the app?
I guess its a CRON job. In PHP I would create a CLI application and use the crontab to run it at specified intervals. Is this the route I should take for iPhone development?
I am creating an app which runs in the background, performing operations at certain times ... How would I go about creating the "behind the scenes" part of the app?
You are really quite limited in what you can do in "background" mode.
There are a handful of options that would allow your app to continue running - register as a background audio player, register as a location-aware app requiring constants updates, or register as a VOIP app. If your app ISN'T one of these, and you declare it is, expect some rejection. Of course, when writing in-house apps (e.g. Enterprise dev) you can register the app as anything you want
If all you need to do is sound an alarm or change your app's badge at some known point in the future, consider instead using the UILocalNotification class. You could use the alarm to get the user's attention, and if they don't respond to the app appropriately then, at the next app start, you'd know they were "naughty".
You could use push notifications in a similar manner. It'd let your server know the user had been / is being naughty much faster
I personally don't see why you'd want an app running constantly in the background (barring audio or location). The memory is a significant constraint - it's real easy to bump that limit and have your app KIA. The OS, after all, is more interested in the foreground apps than your background.
If you really need background services, I'd check out Amazon's EC2. You get enough free time in your first year to keep a micro instance running practically 24/7. Simple & cheap. Or check Google - they have a similar offering. You'd have a lot more processor, memory, and storage to play with.
Yeah, the only reason I say "background" is because it needs to be aware of times. And at certain times; do something.
For example, A scheduler for the iphone volume level. At 9pm the app should change the volume level to zero, and then at 8am turn the volume back up...
That's what I mean by background... So you're not actually physically running the app, but its always there, being aware of the time... You get me?
Yeah, the only reason I say "background" is because it needs to be aware of times. And at certain times; do something.
For example, A scheduler for the iphone volume level. At 9pm the app should change the volume level to zero, and then at 8am turn the volume back up...
That's what I mean by background... So you're not actually physically running the app, but its always there, being aware of the time... You get me?
yes, so use a local notification as lgehrig1 said.
yes, so use a local notification as lgehrig1 said.
That's a no-go, but it could be funny! ** BLART! IT'S 9 PM - TURN YOUR PHONE VOLUME DOWN! **
The local notifications only allow you to play a sound, show an alert, or change your badge (or combo of). If your app is running then your delegate catches it and you can go wild, but if the app isn't running the OS won't start it unless the user clicks "View".
Non-jail broken phone, not willing to declare the app music or location, and not willing to use private API calls. Then no way ...
BTW - I don't know the private API calls. I'd suggest tearing apart the clock or email app.
That's a no-go, but it could be funny! ** BLART! IT'S 9 PM - TURN YOUR PHONE VOLUME DOWN! **
The local notifications only allow you to play a sound, show an alert, or change your badge (or combo of). If your app is running then your delegate catches it and you can go wild, but if the app isn't running the OS won't start it unless the user clicks "View".
Non-jail broken phone, not willing to declare the app music or location, and not willing to use private API calls. Then no way ...
BTW - I don't know the private API calls. I'd suggest tearing apart the clock or email app.
he talked about To-Do list software, it's not a thing to do?
Ah bugger... So I guess I'll have to cater for the Cydia community!
I'm not really in it to make money, I initially wanted it for my own usefulness. And I thought it would be a good way to get into some iPhone development.