Is there a programmatic way to turn on and off the WiFi and Bluetooth networks on the iPhone? I'm looking for the same functionality that Settings/[General/Bluetooth],WiFi/OnOff provides.
Is there a programmatic way to turn on and off the WiFi and Bluetooth networks on the iPhone? I'm looking for the same functionality that Settings/[General/Bluetooth],WiFi/OnOff provides.
There isn't a way using the APIs provided by the SDK. It's trivial to do if you use private frameworks, but if you use private frameworks, you will be in violation of Apple's SDK license agreement.
I've already written such an app for my own purposes (toggling Bluetooth on and off), but for obvious reasons I can't distribute it. Details can be found here if you are interested:
I'm interested about this:
in the PhotoShare application, if the bluetooth is deactived, automatically is activated...
so... how did you think that PhotoShare works??
Thanks for the link but I was wondering actually how to do it (frameworks to import, maybe even some code).
You're going to find a hard time finding that code here, I would suggest you try searching through some cydia apps source code such as Bossprefs or Customize. You can also try searching through the "System" commands that the iPhone utilizes. For example:
This might not be useful to you, but I believe that if you use a GKPeerPicker to connect two iPhones together, it will automatically request that the user enable Bluetooth and provide a dialog box to do so. This isn't much use if, like me, you're making an app that needs to connect multiple clients to a single host.
Not sure if it helps, but there's a key that you can put into the application .plist called 'App requires Wifi' or something similar that I think should ensure that WiFi is available. Sadly it doesn't do the same for Bluetooth.
Replies
There isn't a way using the APIs provided by the SDK. It's trivial to do if you use private frameworks, but if you use private frameworks, you will be in violation of Apple's SDK license agreement.
I've already written such an app for my own purposes (toggling Bluetooth on and off), but for obvious reasons I can't distribute it. Details can be found here if you are interested:
Stormy Productions: The most useful iPhone app I can't release
Cheers.
in the PhotoShare application, if the bluetooth is deactived, automatically is activated...
so... how did you think that PhotoShare works??
See link in post #2 above.
joe
You're going to find a hard time finding that code here, I would suggest you try searching through some cydia apps source code such as Bossprefs or Customize. You can also try searching through the "System" commands that the iPhone utilizes. For example:
<a href="http://www.shmoopi.net/" target="_blank">Check Out The Official Shmoopi LLC Website</a><br />
<a href="http://itunes.apple.com/us/app/iprivatebrowser/id314281847?mt=8" target="_blank">iPrivateBrowser</a> | <a href="http:
Yeah, I figured out how to toggle bluetooth
Awesome. Did you use the above references to figure it out? I haven't had a chance to look at them yet.
i used the private framework called bluetooth manager. i found the .h in spotlight somehow
-Ash
-Ash