Reputation: 2547
I want a service to be active always in the background. Is this possible in the new SDK 7.1
I read through the Background File Transfers, Agents, and Alarms. I think these are only active for a period of time.
Upvotes: 0
Views: 92
Reputation: 84784
Short answer: you can't
Background agents can only run for 15 seconds every ~30 minutes. Attempting to run for longer will result in the agent being terminated and not rescheduled. Riho is referring to something different: if the user does not run the owner application for 14 days your agent won't be rescheduled (even if it's successful); the application must be run and reschedule the agent.
Your only real choice is to move the functionality to the server and use push notifications to update the phone.
Upvotes: 1
Reputation: 4593
Agent gets deactivated after 14 days. Within that time you must make user to open your foreground application - then you can restart the agent and 14 days counter again.
Upvotes: 0