Tuesday, December 28, 2010

What to Do with UIRequiresPersistentWiFi

Last night I was watching a streamed TV show (*) from great archives of national broadcasting company. At about 32 minutes it stopped! Couldn't restart the show, couldn't pause and restart, couldn't stop and restart, couldn't restart the application to restart the show.

Application was ok, responsing well. Just wouldn't play anything for me.

By coincident I had earlier same day read about UIRequiresPersistentWiFi. I don't believe in coincidents, but love when they happen! Here's a long quote from Apple iOS Reference Library article "Tuning for Performance and Responsiveness":
If your application accesses the network using the Wi-Fi radios, you must notify the system of that fact by including the UIRequiresPersistentWiFi key in the application’s Info.plist file. The inclusion of this key lets the system know that it should display the network selection panel if it detects any active Wi-Fi hot spots. It also lets the system know that it should not attempt to shut down the Wi-Fi hardware while your application is running.

To prevent the Wi-Fi hardware from using too much power, iOS has a built-in timer that turns off the hardware completely after 30 minutes if no running application has requested its use through the UIRequiresPersistentWiFi key. If the user launches an application that includes the key, iOS effectively disables the timer for the duration of the application’s life cycle. As soon as that application quits or is suspended, however, the system reenables the timer.
My guess is that the specific iPad application did NOT have UIRequiresPersistentWiFi in its Info.plist file.

After reading the docs, I would initially very strongly recommend NOT to use UIRequiresPersistentWiFi. Uses to much battery, shortens device runtime. However now that I've seen and experienced the problem first-hand, I can say that there are moments when it should be used.

If only you could use it dynamically, at runtime. Only when you really need it...

* Btw the TV show in question was "Terry Pratchett: Living with Alzheimer's". Just wanted to mention, because I'm a fan of Discworld series and because Alzheimer's is really a horrible, and so far, incurable illness.

Sir Terry Pratchett was a brave man to go public with all of this. Anybody can get it. You. Me. Take a moment to think about it, take a moment to think about Terry Pratchett.
“Sorry. The shadow keeps falling across the page. Sorry.”
What can you do...

No comments:

Post a Comment