user824249
user824249

Reputation:

Switching flight mode programmatically

Is there any way switch on/off flight mode programmatically in Windows Phone 7.5. What I want to do is create background task which will be check time and switch on/off flight mode.

Thanks in advance.

Upvotes: 4

Views: 1797

Answers (2)

Jared Bienz - MSFT
Jared Bienz - MSFT

Reputation: 3550

Though you cannot programatically do it (as others have mentioned), you can send the user directly to the proper page in the settings panel and allow them to do it. Here's an example of using the ConnectionsSettingsTask:

http://msdn.microsoft.com/en-us/library/hh394011(v=VS.92).aspx

You would want to set the ConnectionSettingsType property:

http://msdn.microsoft.com/en-us/library/microsoft.phone.tasks.connectionsettingstask.connectionsettingstype(v=VS.92).aspx

To 'AirplaneMode'.

Upvotes: 4

Matt Lacey
Matt Lacey

Reputation: 65556

No, this functionality is not available.

It was a design principle behind the platform that applications should not be able to do things without the user knowing it.
If such functionality was available then it would be possible for an app (either deliberately or accidentally-though a bug) to get the devices state in a setting other than what they user may expect. In such a scenario users will typically blaim the phone/platform for what has happened, not a misbehaving application.

Upvotes: 6

Related Questions