tags:

views:

1223

answers:

6

Hi! Does anyone know how to de/activate the airplane mode programatically on the iPhone (OS 2.1)?

A: 

How about this?

Fermin
I found that too. Looks like quite a hack. Do you think this kind of thing would be discouraged by Apple?
Felixyz
To be honest I think they might but, hey, if it works....
Fermin
Apple will *not* allow you to use that on the App Store. It is a private framework, and it's private for a good reason.
ceejayoz
+14  A: 

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.

LB
Wish I could vote more than once. +1
John MacIntyre
I agree this shouldn't be common, but there are cases when it can make sense. For example, if the application is a mediation countdown. Why not give the user the *option* to disable incoming calls, etc. First, it's an option (they don't have to do it). Second, if you're meditating you probably don't want to be interrupted (but you still may want to use the app). And third, if I always want that option enabled when I meditate, then I don't have to manually do it every time before I start the timer.
Ryan
This is exactly the usage my clients had in mind: the app would state clearly to the user that this is an **option**, not more. And on closing, the app would always restore the airplane mode to whatever it was before the app launched. That said, I still think this would never be approved, so I'd advice against it purely on those grounds.
Felixyz
In general I wouldn't want apps to silently monkey with my network settings, but I would love to have a settings helper app that could save profiles (e.g. Home, Work, Coffee Shop, Focus/no interruptions) to enable wifi, pick wifi networks, turn 3G/edge on-off, mute the volume etc. in fewer clicks than having to hunt through the system preferences.
nick
+1  A: 

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.

Marco
A customer asked me to do this. I gave him pretty much the same answer as you. Apart from this not being in the public API, Apple states elsewhere that apps shouldn't try to make decisions on events outside of their scope.
Felixyz
But more briefly: they thought the nature of the app was such that "users don't want to be interrupted".
Felixyz
A: 

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.

Airsource Ltd
A: 

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.

Eric
A: 

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.

Stuart