Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Howto programmatically turn on/off WiFi and Bluetooth?

ae6rtae6rt Posts: 28Registered Users
edited October 2010 in iOS SDK Development
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.

Thanks.
Post edited by ae6rt on
·

Replies

  • mosttornbrainmosttornbrain Posts: 42Registered Users
    edited September 2008
    ae6rt wrote: »
    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:

    Stormy Productions: The most useful iPhone app I can't release

    Cheers.
    ·
  • ae6rtae6rt Posts: 28Registered Users
    edited September 2008
    Thanks. That's what I suspected. Too bad. Hopefully this will be part of the public API one day.
    ·
  • ghibozghiboz Posts: 11Registered Users
    edited September 2009
    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??
    ·
  • johnathonjohnathon Posts: 216Registered Users
    edited November 2009
    Can you please tell me how to programatically turn on Bluetooth using the private api.
    ·
  • FlyingDiverFlyingDiver Posts: 997Registered Users
    edited November 2009
    johnathon wrote: »
    Can you please tell me how to programatically turn on Bluetooth using the private api.

    See link in post #2 above.

    joe
    ·
  • johnathonjohnathon Posts: 216Registered Users
    edited November 2009
    Thanks for the link but I was wondering actually how to do it (frameworks to import, maybe even some code).
    ·
  • ShmoopiShmoopi Posts: 213Tutorial Authors, Registered Users
    edited November 2009
    johnathon wrote: »
    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:
    system("killall springboard");
    
    [SIGPIC][/SIGPIC]<br />
    <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:
    ·
  • johnathonjohnathon Posts: 216Registered Users
    edited November 2009
    I found this but how do i use it. How do I refere to the bluetooth?
    ·
  • KZSKZS Posts: 61Registered Users
    edited February 2010
    Hey, did you get anywhere with this lately? I hope Apple releases some new APIs in OS 4.0.
    ·
  • johnathonjohnathon Posts: 216Registered Users
    edited February 2010
    KZS wrote: »
    Hey, did you get anywhere with this lately? I hope Apple releases some new APIs in OS 4.0.


    Yeah, I figured out how to toggle bluetooth
    ·
  • KZSKZS Posts: 61Registered Users
    edited February 2010
    johnathon wrote: »
    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.
    ·
  • johnathonjohnathon Posts: 216Registered Users
    edited February 2010
    KZS wrote: »
    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
    ·
  • DestriarchDestriarch Posts: 3New Users
    edited October 2010
    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.

    -Ash
    ·
  • iSDKiSDK Posts: 1,353Tutorial Authors, Registered Users @ @ @ @
    edited October 2010
    Did you ever work out how to toggle wifi?
    ·
  • DestriarchDestriarch Posts: 3New Users
    edited October 2010
    iSDK wrote: »
    Did you ever work out how to toggle wifi?
    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.

    -Ash
    ·
Sign In or Register to comment.