Turn Windows Phone Settings On/Off

2019-02-14 08:35发布

问题:

OK What I need to do is fairly straightforward : Be able to programmatically (via some API) turn system settings on/off, like :

  • WiFi
  • Bluetooth
  • Cellular
  • FM Radio

Any ideas on how to go about that? (I've searched everywhere and found nothing up-to-date)

回答1:

You can't change them programmatically in Windows Phone, but you can ask a user to change them and redirect a user to the Settings page (for this purpose use ConnectionSettingsTask http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh394011(v=vs.105).aspx).



回答2:

you cannot change the settings through code but you can direct the user to the settings page by using the following navigation statement .

in this it will navigate to settings location page .. from this you can set location settings

similarly you can go to wifi and other settings

var navigate = Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings-location:"));



回答3:

You can't actually change them programmatically. However, you can determine if they're enabled or not, and send the user to the appropriate settings page to enable/disable themselves.



回答4:

Use ConnectionSettingsTask class and use below code to launch setting page for changing settings -

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

ConnectionSettingsType is an enum which have all four properties which will navigate you on corresponding setting page.

Hope this will help