Execute a method with the application closed "Service"

3

In Android it is possible to send notifications, make queries via http, execute methods, all through a Service without the user having to run the application, just because the service is active, everything happens naturally. I see that in iOS there is no such concept of Services.

How do I perform a simple method (from time to time) without having to open the application manually, ie a concept of "Service".

    
asked by anonymous 17.06.2015 / 16:42

1 answer

3

It depends on what you mean by "from time to time."

In fact iOS does not have all the freedom that exists on Android. There are Background Modes (see Table 3-1) , each for a specific need. I believe that the closest you need is fetch :

  

The app regularly downloads and processes small amounts of content   from the network.

What happens in this case is that when implementing the delegate application:performFetchWithCompletionHandler: , iOS itself determines how often this task is executed, based on each device, usage, network availability, and other factors, then you'll have about 30 seconds (see the link discussion) to do everything you want until the app is finished again.

Anyway, I think the most you can get is this.

    
17.06.2015 / 16:58