Hi! Does anyone know how to de/activate the airplane mode programatically on the iPhone (OS 2.1)?
You probaby shouldn't programmatically turn on airplane mode in the first place.
I think it's best to let the user decide since other apps may be open and require connectivity.
It is not possible to do this with the public APIs, which means that Apple won't approve an app for the App Store that does this.
Of course, you generally shouldn't do this anyway. I'm curious to hear the reason you had in mind.
Every testing house I've come across has a test to see if a phone call still works properly when an application is running. This would break that. Separate from that, I'm having a very hard time imagining a worse user experience. It is the height of arrogance to tell the user that the application they are using is more important than any phone call or SMS they might get.
Actually, there's a great reason to do this: to provide the user the ability to toggle airplane mode without leaving your app. I'm writing an app for pilots...who are in airplanes. Hmmm...not forcing them to exit and switch apps to turn on airplane mode seems like a good idea when I could just give them a toggle switch to do it.
What about the option that is available on almost all other phones that would let you stop the phone from ringing or chiming when it receives a message through the night? Why can't Apple offer something that says after 11pm and until 6:30am, don't bother me with inbound messages.
I understand that airplane mode is pretty much like the sledgehammer approach, but it's the shortest route to getting the &#$& thing to shut up overnight. The last thing I need to have awaken me at 3am is newsletters from dozens of sources.