以编程方式切换飞行模式
有没有办法在 Windows Phone 7.5 中以编程方式打开/关闭飞行模式。我想要做的是创建后台任务,该任务将检查时间并打开/关闭飞行模式。
提前致谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不,此功能不可用。
平台背后的设计原则是应用程序不应该在用户不知情的情况下执行某些操作。
如果此类功能可用,那么应用程序就有可能(有意或无意 - 尽管是一个错误)将设备状态设置为用户期望之外的设置。在这种情况下,用户通常会将所发生的事情归咎于手机/平台,而不是行为不当的应用程序。
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.
尽管您无法以编程方式执行此操作(正如其他人提到的),但您可以将用户直接发送到设置面板中的正确页面并允许他们执行此操作。下面是使用 ConnectionsSettingsTask 的示例:
http:// msdn.microsoft.com/en-us/library/hh394011(v=VS.92).aspx
您需要设置 ConnectionSettingsType 属性:
http://msdn。 microsoft.com/en-us/library/microsoft.phone.tasks.connectionsettingstask.connectionsettingstype(v=VS.92).aspx
至“飞行模式”。
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'.