apalopohapa
apalopohapa

Reputation: 5183

How to trigger a WiFi connection on iPhone SDK 4.1

Sometimes the iOS device will not connect to the available WiFi automatically, but it will if Safari is launched and try to browse to any site (or go to Settings->Wi-Fi and select the desired network). This is probably for battery savings reasons.

How to trigger this from your app?

Upvotes: 0

Views: 1073

Answers (2)

tc.
tc.

Reputation: 33592

You can try something like <key>UIRequiredDeviceCapabilities</key><array><string>wifi</string></array> in Info.plist. It actually means "persistent wifi" (i.e. keep Wi-Fi up even when the display is asleep), but it might also trigger a reconnection.

EDIT: Alternatively, <key>UIRequiredDeviceCapabilities</key><dict><key>wifi</key><true/></dict>. There's also <key>UIRequiresPersistentWiFi</key><true/> which does something slightly different.

Upvotes: 1

hotpaw2
hotpaw2

Reputation: 70733

The higher level Cocoa Touch network APIs will attempt to turn on the radios if needed. Until then they are kept off as much as possible to conserve battery power (after certain time-outs).

Safari probably uses one of the high level HTTP APIs for browsing.

Upvotes: 1

Related Questions