Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 04-21-2011, 10:28 AM   #1 (permalink)
Registered Member
 
Join Date: Apr 2011
Posts: 6
christatedavies is on a distinguished road
Default App as a service

Hello.

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?

Thanks for any tips, and help.

Chris
christatedavies is offline   Reply With Quote
Old 04-21-2011, 10:57 AM   #2 (permalink)
Senior Member
iPhone Dev SDK Supporter
 
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 24
Posts: 3,983
smithdale87 is on a distinguished road
Send a message via AIM to smithdale87
Default

There's no such thing as an app that runs in the background on a non-jailbroken device. Are you aware of this?
smithdale87 is offline   Reply With Quote
Old 04-21-2011, 11:15 AM   #3 (permalink)
Registered Member
 
Join Date: Apr 2011
Posts: 6
christatedavies is on a distinguished road
Default

Quote:
Originally Posted by smithdale87 View Post
There's no such thing as an app that runs in the background on a non-jailbroken device. Are you aware of this?
What about to do lists? Task managers that remind you of overdue tasks? Perhaps I didn't explain myself very well.

They must be running in the background.

Is it the Push service? I guess I should look into that.
christatedavies is offline   Reply With Quote
Old 04-21-2011, 11:16 AM   #4 (permalink)
Registered Member
 
Join Date: Jan 2011
Location: South Florida, US
Posts: 357
lgehrig1 is on a distinguished road
Default

Quote:
Originally Posted by christatedavies View Post
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.
lgehrig1 is offline   Reply With Quote
Old 04-21-2011, 11:20 AM   #5 (permalink)
Registered Member
 
Join Date: Apr 2011
Posts: 6
christatedavies is on a distinguished road
Default

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?
christatedavies is offline   Reply With Quote
Old 04-21-2011, 11:41 AM   #6 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

Quote:
Originally Posted by christatedavies View Post
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.
__________________
dany_dev is offline   Reply With Quote
Old 04-21-2011, 11:47 AM   #7 (permalink)
Registered Member
 
Join Date: Jan 2011
Location: South Florida, US
Posts: 357
lgehrig1 is on a distinguished road
Default

Quote:
Originally Posted by dany_dev View Post
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.
lgehrig1 is offline   Reply With Quote
Old 04-21-2011, 11:49 AM   #8 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

Quote:
Originally Posted by lgehrig1 View Post
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?
__________________
dany_dev is offline   Reply With Quote
Old 04-21-2011, 11:59 AM   #9 (permalink)
Registered Member
 
Join Date: Apr 2011
Posts: 6
christatedavies is on a distinguished road
Default

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.

Cheers for your suggestions and comments guys.
christatedavies is offline   Reply With Quote
Reply

Bookmarks

Tags
cron, scheduled, timed, timer

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 347
13 members and 334 guests
dansparrow, dre, iOS.Lover, lorrettaui53, Nobbsy, Objective Zero, oztemel, pbart, PlutoPrime, samdanielblr, sledzeppelin, thephotographer, Trickphotostudios
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,663
Threads: 94,119
Posts: 402,896
Top Poster: BrianSlick (7,990)
Welcome to our newest member, LezB44
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:50 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0