Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WiFi connection is dropped after user inactivity period

Tags:

iphone

wifi

My iPhone application establishes a TCP connection through wifi to a remote server. However, if there is no user activity for a certain time, the device closes wifi and drops the connection. Is it possible to prevent it? I need the connection to be persistent while the application is running. Setting setIdleTimerDisabled:YES doesn't help - it prevents the screen to go off, but still the wifi is closed.

Do you know if this is possible and how to achieve it?

like image 731
Vladimir Grigorov Avatar asked Feb 02 '26 17:02

Vladimir Grigorov


1 Answers

Check out this URL: http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/ApplicationEnvironment/ApplicationEnvironment.html#//apple_ref/doc/uid/TP40007072-CH7-SW59

Table 1-3 Important keys in the Info.plist file

UIRequiresPersistentWiFi:

A Boolean value that notifies the system that the application uses the Wi-Fi network for communication. Applications that use Wi-Fi for any period of time must set this key to true; otherwise, after 30 minutes, the device shuts down Wi-Fi connections to save power. Setting this flag also lets the system know that it should display the network selection dialog when Wi-Fi is available but not currently being used. The default value is false.

like image 138
Dutchie432 Avatar answered Feb 04 '26 06:02

Dutchie432



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!