How to make iOS app maintain network in background indefinitely

I am working on a casting app that uses google chromecast and cast framework to cast anything on web on the TV, not only videos from youtube, and I managed to make the app fully functional, but one more thing I need to implement, is make the app work with remote controls on the lock screen and control center, and for that to happen, I need the app always running in background and using network to be able to communicate with the cast device. I have noticed youtube does the same thing, but how can I do it? I have tried checking VOIP under background modes in xcodes, but that didn't make it. Here's the property I need to set from google documentation that says the app needs to be always running in background and using network: https://i.stack.imgur.com/siDCs.png

The answer to your direct question:

How to make iOS app maintain network in background indefinitely

is that there is no general-purpose way to remaining running in the background indefinitely. It’s possible to do this in specific circumstances (like audio playback and turn-by-turn navigation) but none of them match your use case.

I have tried checking VOIP under background modes in xcodes, but that didn't make it.

The

voip
background mode definitely won’t help. There are two different VoIP technologies:
  • Legacy VoIP (via

    NSStreamNetworkServiceTypeVoIP
    and friends)
  • PushKit-based VoIP

Both of these involve the VoIP app suspending in the background and then being resumed when the phone ‘rings’.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

So how does youtube does this?

Do I need to make something like audio playback in background execution and play an empty audio track or something?

did you find a solution ?

did you find a solution ?

iOS has general-purpose way to run indefinitely in the background. Rather, it provides a variety of special-purpose features tailored for specific user scenarios. My advice here is that you start a new thread that describes the specific problem you’re trying to solve. Tag it with BackgroundTasks so that I see it.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
How to make iOS app maintain network in background indefinitely
 
 
Q