brickBreaker
brickBreaker

Reputation: 339

Android / iOS: schedule task while app is in background / off

When a Server wants to contact a client, though the corresponding app is inactive or off, he can do this via Google Cloud Messaging. My little application runs in combination with a webserver which I do not own and only runs php on, so actively contacting a client is impossible.

Now there are apps with probably similar problems, such as the Email apps. Mailservers never manually contact their clients, when a new message was received, so they check for new messages every, say, 30 minutes.

My question is: Is it possible to run such a background task? And is there a way to do this in iOS, too?

Thanks in advance!

Upvotes: 2

Views: 990

Answers (1)

Joel
Joel

Reputation: 4772

If there is something you want android to do when the user is not interacting with the widget/application, you should use a service.

Android Service

It is meant to be used for tasks that require no user interaction and is especially great for checking something over and over. No guarantee that the os still wont kill it eventually, but it kept alive as long as possible. You can also create a service to be restarted anytime it dies, if you really want to do something long term.

Upvotes: 1

Related Questions