Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Will ios terminate the app running in background after a specific time?

I am using core location framework inside my application and I set the location string in UIBackgroundMode or Required background modes(in Xcode 4.2) for getting the updated location from didUpdateToLocation method when app is running in background and also sending this updated location to server by hitting the specific link inside didUpdateToLocation method of core location framework.

My question is that will the app be terminated after some time when running in background or not?

like image 642
iosuser Avatar asked Jun 07 '12 05:06

iosuser


People also ask

How long will an iOS app run in the background?

Typically, iOS policies permit up to 10 minutes of background time after the app is suspended or the device is locked. In practice this time can vary wildly, but we request as much time as the system will allow.

Does iPhone automatically close apps?

Automatically Close Apps after Non-Usage on Your iPhone On iPhone X, iPhone 11, or an iPad with iOS 12 or later, swipe your finger up while on the Home screen, and hold the screen's middle to dismiss apps you don't use. On an iPhone 8 or earlier, click on the Home button twice to show your most recently used apps.

Do apps automatically close?

If there's not adequate storage space on your phone, it is also likely to trigger all apps automatically close on Android. Everyone has some apps and files that are used not frequently and some of these apps and data occupy quite a lot of resources of your phone.

Do Apple apps run in the background?

Some apps keep running in the background when you return to the home screen. You can set your mobile phone to refresh apps in the background so that you'll still get notifications even if the app isn't actively in use.


2 Answers

No, there is no specific time defined for this.But app will definitely terminate based upon certain parameter - battery drain, memory footprint issue etc.

In developer documentation it is clearly mentioned - "The system keeps suspended apps in memory for as long as possible, removing them only when the amount of free memory gets low. Remaining in memory means that subsequent launches of your app are much faster."

Go through this for complete details - http://developer.apple.com/library/ios/#DOCUMENTATION/iPhone/Conceptual/iPhoneOSProgrammingGuide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html

like image 143
rishi Avatar answered Sep 25 '22 07:09

rishi


I am sure it is not useful for the author because the question was asked in June 2012 and I am giving an answer in June 2019. This answer maybe is useful for other users.

I am posting this answer because Everyone is said that it is OS default behaviour, We can not change it....bla....bla.

Recently, I was working with the same requirement. After 2-3 week hard work, I did it. For other users, I create a helper class for it. My app will never be killed by OS until the location tracking enabled.

You can also verify that OS will never kill this app tracking app

Use HSLocationManager for infinite location tracking in the active and inactive state.

Refer my app which is available in the app store(App will never kill by OS if location tracking is enabled)

Location manager that allows getting background location updates every n seconds with desired location accuracy.

Advantage:

  • OS will never kill our app if the location manager is currently running.

  • Give periodically location update when it required(range is between 2 - 170 seconds (limited by max allowed background task time))

  • Customizable location accuracy and time period.

  • Low memory consumption(Singleton class)

like image 26
Hitesh Surani Avatar answered Sep 21 '22 07:09

Hitesh Surani