What's new

Background work while app is "off"

denn1s

iPF Noob
Is it possible to make app working at background when it's actually not activated (via tapping) by user.

For example i have an app, that runs cafe. And in this cafe chief is baking some food. When user disables app (running other apps, etc) i need baking to keep going and when dish is ready (for example remote server that serves app sends notification to user's iPad's Cafe-App) i want to send a notification to user saying "Your dish in Cafe-App is ready. Go and serve it before it get burn".

Is it possible?
Which approach i should use?
Is there any topics/docs describing this problem?

update.
This looks like solution:
developer(dot)apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Introduction/Introduction.html
 
Last edited:
The problem is that iOS 4.2 and 4.3 are not really ‘multi-tasking’ in the way that most users understand. In your PC or Mac, what you are suggesting is eminently possible. But iOS is really a ‘task switcher’ and moves tasks/apps in and out of RAM (system memory) and stores their context (state) so that, when they’re reloaded, they start up in exactly the same state as when they were removed from RAM. Only a very limited background activity is allowed by iOS - for example file download/upload, playing music etc. There are, of course, timer/alarm ‘notifications’ that an app can have pushed to the iPad’s screen - say by apps such as ‘Calendar’ or other task/project management/alarm apps, as well as games - so you could have your ‘Café’ app time how long a customer’s dish is going to take to cook and then push a ‘notification’ to the iPad screen when it’s ready (‘Mr. John Doe’s Lasagne is ready’) but this would be a simple timer-style app that would run independently of any external ‘agent’. Yes, it would ‘run’ if the ‘Café’ app had been offloaded by iOS, because iOS itself is responsible for handling ‘notifications’. But whether an external agent - the server you mentioned - could *externally* trigger such an event when the ‘Café’, I don’t think is possible because iOS aggressively ‘sandboxes’ (isolates) apps from each other (advantage - no virus infection possible in the iPad) and rigorously controls the app<->OS interaction.

I’m sure that other more-experienced Forum members will be able to add much more to this argument.

Tim
Scotland
 
I should have mentioned that, if you’re interested in developing your own apps or simply reading about this in more detail, a good start is the Apple iPad Developer’s Page.

Start Developing iPad Apps - Apple Developer

There are, of course too, any number of books/eBooks available in iBooks or Amazon.

Good luck with your very interesting idea.

Tim
Scotland
 
hey Tim, thanx for answers

Seems that iOS' Push Notifications system is the one that handles Pushes from outside the device (from some external server for example) and allows to implement my idea having dishes preparation be synced with external servers.

and you're right about timing approach and using of internal notifications. this may fit when user disables network. in fact these two approaches can be combined =)
 
Sounds great - I'd love to know how you get on with this because I think there are a number of other Forum members who have been thinking of other apps that need this sort of external push.

Oh - and don't forget to invite us to your cafe once you've implemented the idea!! :)

Tim
Scotland
 
Hi all,

thanks for the posts. I have in mind a similar idea and haven't found much around it. Glad to see your posts here.
Similar to the cafe, what I would like to achieve is super simple:

- I am thinking of an app able to run on the background and show pop up messages every x hours (i.e. 1 hour started says Hi!, after 1 more it says "How are you?" and so on... of course what I have in mind is a bit more interesting...

The idea being:
- This messages should be already preloaded in the app
- Therefore no need for connectivity from internet

Would appreciate a lot if, before I actually move forward with this using something such as the push notifications, anybody can give me some ideas on how to better achieve this. Would be also good if you know of a reference or library I can refer to in Xcode.

THanks all
 

Most reactions

Latest posts

Back
Top