Constantly running in the background, avoiding the use of a 10-minute time limit

I want to create a service view application that runs in the background, but the problem in the iOS application is limited to 10 minutes.

Is there a way by which we can constantly run our application, I read something that if we play a song in the background, the application will never stop after 10 minutes, but I do not think that the apple will approve it.

Any suggestion would be helpful.

+4
source share
2 answers

From the iOS Developer Library:

iOS 7 supports two new background modes for apps:

Applications that regularly require new content can register with the system and periodically launch or run in order to download this content into the background. To register, enable the UIBackgroundModes key with the fetch value in your application Info.plist file and set the minimum time you want between fetch operations using setMinimumBackgroundFetchInterval: You should also implement application:performFetchWithCompletionHandler: in your application, the delegate will perform any downloads. Applications that use push notifications to notify the user that new content is available can now use these notifications to trigger background download operations. To support this mode includes the UIBackgroundModes key with the remote notification value in your Info.plist file. Your delegate application should also implement the application:didReceiveRemoteNotification:fetchCompletionHandler: Method.

First case: By setMinimumBackgroundFetchInterval: to UIApplicationBackgroundFetchIntervalMinimum or any other number in a few seconds (inside your AppDelegate), you will notify the system that your application requires updating its content, even if it is in the background.

Note. The sampling interval is a minimum not a maximum! Thus, your application will wake up when the system solves it. It can be once a day or several times a day. In my case, my application was updated app. every 10 minutes until 19:00. After this time, approx. 7 hours for the next update and 3 hours for the very next. The next day the same thing (every 10 minutes until 19:00).

This method is ideal if you request regular updates from the Internet (efficient and low battery consumption), but NOT for things that require updates in a short amount of time, such as battery level or battery status.

Hope this helps.

iOS 7 is still in beta. So, all of the above can change or update to the official release.

+6
source

@rckoenes is right in his short answer, but in iOS7 you can do it, Apple Developer Portal :

Update the contents of your application by adopting the new multi-tasking API in iOS 7. New services allow your application to update information and download content in the background without draining the battery unnecessarily. Updates can occur at opportunistic times and are reasonably planned according to usage, so your application can only update content in the background only when your users need it.

+2
source

Source: https://habr.com/ru/post/1500678/


All Articles