iOS application runs after end of background task
Resolved.
The cause was improper preparing of tcp connection for background mode.
The right way for me:
- Create pair of streams for BSD socket (i use bsd sockets)
- Set kCFStreamPropertyShouldCloseNativeSocket to kCFBooleanFalse for both streams
- Set kCFStreamNetworkServiceType to kCFStreamNetworkServiceTypeVoIP for both streams
Steps 1) - 3) runs after receiving of first data from server.
iOS voip app sleeps & Reachability has changed, can I get notification?
Answer was both Yes and No:
- Register to Reachability network changes notifications.
- If App goes to background suspended while its voip socket (see link) is connected, then uppon network changes app will wake up at background for 10 seconds.
- If App goes to background suspended while its voip socket is NOT connected, then uppon network changes app will NOT wake up.
- The solution for the scenario of network loss and going to background with no connection may be fixing the connection in the Keep-Alive block that you can schedule at UIApplication.
- Note: during the mentioned 10 sec, you may ask for a background task in order to finish the reconnection job.
Links:
- VoIP socket in iOS
- VoIP socket wakeups - iOS 5 Watchdog
VOIP and background functionality
There is one possible 'hack' which would allow your app to run indefinitely in background. But beware, Apple will reject your app instantly.
Pastebot looped a silent MP3 in the background to keep itself continuously active. You can read more about that process and Apple's rejection of it here.
iOS transfer RTP VoIP call to background
Answer to (1):
iOS VoIP apps may keep a single TCP socket at background, usually your SIP socket, to allow incoming calls (INVITEs).
While your app has an active call, and goes to background, It has no restrictions, you can keep as many sockets as you want.
Here is a more detailed answer from another thread
Regarding the SIP stack implementation, you may want to check open-source PJSip stack
Related Topics
Does Webkit in iOS 11 (Beta) Support Webrtc
React-Native iOS Podfile Issue with "Use_Native_Modules!"
Ckquery from Private Zone Returns Only First 100 Ckrecords from in Cloudkit
How to Add Text Using Paths Drawing
Get User Profile Details (Especially Email Address) from Twitter in iOS
Set Text Color and Font for Uidatepicker in iOS8/Swift
How to Integrate Crashlytics into an iOS Framework Target
Swiftui Show/Hide Title Issues with Navigationbar
What Are the Differences Between a Uiview and a Calayer
iOS 7 Uitableview: How to Remove Space Between Navigation Bar and First Cell
How to Create a Uiimage from the Current Graphics Context
Go VS. Return Button in iOS Keyboard for HTML Input Forms
Toggling Airplane Mode in iOS Programmatically
Region Monitoring Glitch on iOS 7 - Multiple Notifications at the Same Time
How to Save Created PDF in Document Folder and Merge in iOS
Different Cornerradius for Each Corner Swift 3 - iOS
iOS Facebook Graph API Profile Picture Link
iOS Web Page Errors Over Cellular Data But Not Over Wifi? Recent Change to At&T Cellular Network