Further understanding of iOS background mode up to 10 minutes running time

Source: Internet
Author: User

When the app enters the background, the system initial default is only 10s processing time, but if the 10s is not enough, we can actively apply, the Internet circulated the most of a saying is 10 minutes.

But this argument has a premise:

That's the way it was before iOS7.

But from iOS7 onwards, we apply, up to only 180s of processing time (3 minutes), has been quite incomprehensible, why became 3 minutes.

Application Method Swift notation:

var backgroundtaskidentifier:uibackgroundtaskidentifier!



Backgroundtaskidentifier = Uiapplication.sharedapplication (). Beginbackgroundtaskwithexpirationhandler ({ Uiapplication.sharedapplication (). Endbackgroundtask (self.backgroundtaskidentifier) if Self.backgroundtaskidentifier! = uibackgroundtaskinvalid{ Self.backgroundtaskidentifier = Uibackgroundtaskinvalid } })

  

Later I saw a saying that:

The system actively divides 10 minutes into the allocation of n times, the total background time can still be 10 minutes, but each time we apply, but only to get 180s of time, many times later, the total time to reach 10 minutes, even if the application again, are invalid.

So how many applications do you make?

I'm talking about a situation that I met:

For example, even if the app is always in the background, but my side can receive the system callback (I use ibeacon), each time I receive a callback, I can wake up the application of 10s, in theory, this wake-up system will only assign you 10s processing time, But I also found that 10s time is not enough for me to finish everything.

So my situation, just can meet this scenario, I just need to apply once again in my callback method to extend the time, you can get a maximum of 180s processing time, of course, if you finish 20s, time is only 20s.

Multiple applications until the system accumulates to 600s time, the system will stop.

This application scenario can be fully used for 10 minutes, so the recording is for reference only.

Further understanding of iOS background mode up to 10 minutes running time

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.