How can I turn on/off WiFi programatically on WP7

跟風遠走 提交于 2019-12-19 08:53:00

问题


I would like to know if there is any possibility to turn wifi on and off programatically. My idea is to have a background task looking for geocoordinates and toggle the wifi settings wether the phone is in the range of a former saved location or not.

Yet everything I saw were apps which get the state of the wifi and quick jump to the wifi settings. I would like to implement a more automated app which helps saving battery power.


回答1:


Sorry, you can't programmatically turn on or off the wifi. The best you can do is displaying the WIFI settings page and let the user take care of it.




回答2:


You can show the dialog like this.

ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask();
connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.WiFi; 
connectionSettingsTask.Show();


来源:https://stackoverflow.com/questions/9247958/how-can-i-turn-on-off-wifi-programatically-on-wp7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!