Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 09-04-2008, 12:16 PM   #1 (permalink)
New Member
 
Join Date: Aug 2008
Posts: 28
Default Howto programmatically turn on/off WiFi and Bluetooth?

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.
ae6rt is offline   Reply With Quote
Old 09-04-2008, 01:33 PM   #2 (permalink)
Registered Member
 
mosttornbrain's Avatar
 
Join Date: Sep 2008
Location: Woonsocket, RI
Age: 44
Posts: 42
Default

Quote:
Originally Posted by ae6rt View Post
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.
mosttornbrain is offline   Reply With Quote
Old 09-04-2008, 02:09 PM   #3 (permalink)
New Member
 
Join Date: Aug 2008
Posts: 28
Default

Thanks. That's what I suspected. Too bad. Hopefully this will be part of the public API one day.
ae6rt is offline   Reply With Quote
Old 09-26-2009, 06:55 PM   #4 (permalink)
Registered Member
 
ghiboz's Avatar
 
Join Date: Apr 2009
Posts: 11
Default

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??
ghiboz is offline   Reply With Quote
Old 11-15-2009, 12:37 PM   #5 (permalink)
Registered Member
 
Join Date: Aug 2009
Posts: 216
Default

Can you please tell me how to programatically turn on Bluetooth using the private api.
johnathon is offline   Reply With Quote
Old 11-15-2009, 01:14 PM   #6 (permalink)
Former NeXTStep Developer
 
Join Date: Mar 2009
Posts: 997
Default

Quote:
Originally Posted by johnathon View Post
Can you please tell me how to programatically turn on Bluetooth using the private api.
See link in post #2 above.

joe
FlyingDiver is offline   Reply With Quote
Old 11-15-2009, 02:43 PM   #7 (permalink)
Registered Member
 
Join Date: Jul 2009
Posts: 566
Default

Yep - the issue is private frameworks. Which means Apple will most definitely reject the app.

There are alternatives, however. The Jailbreak Community can always make use of apps like that. However, from what I've been seeing of late, the "Jailbreak Community" is dying off pretty fast, as a lot of the devs for it are either moving to the App Store, or simply charging obscene prices for once free apps. They either handle their records poorly, or simply don't care, and as a result many "buyers" of their apps have been completely screwed over. ZodTTD, I'm looking at you.
Noise is offline   Reply With Quote
Old 11-15-2009, 05:49 PM   #8 (permalink)
Registered Member
 
Join Date: Aug 2009
Posts: 216
Default

Thanks for the link but I was wondering actually how to do it (frameworks to import, maybe even some code).
johnathon is offline   Reply With Quote
Old 11-15-2009, 10:18 PM   #9 (permalink)
Shmoopi LLC
 
Shmoopi's Avatar
 
Join Date: Jun 2009
Location: Virginia
Posts: 203
Default

Quote:
Originally Posted by johnathon View Post
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:
Code:
system("killall springboard");
Shmoopi is offline   Reply With Quote
Old 11-16-2009, 12:44 PM   #10 (permalink)
Registered Member
 
Join Date: Aug 2009
Posts: 216
Default

I found this but how do i use it. How do I refere to the bluetooth?
johnathon is offline   Reply With Quote
Old 02-02-2010, 11:43 AM   #11 (permalink)
KZS
Registered Member
 
Join Date: Jan 2009
Location: Ontario, Canada
Posts: 55
Default

Hey, did you get anywhere with this lately? I hope Apple releases some new APIs in OS 4.0.
KZS is offline   Reply With Quote
Old 02-03-2010, 01:11 PM   #12 (permalink)
Registered Member
 
Join Date: Aug 2009
Posts: 216
Default

Quote:
Originally Posted by KZS View Post
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
johnathon is offline   Reply With Quote
Old 02-03-2010, 02:28 PM   #13 (permalink)
KZS
Registered Member
 
Join Date: Jan 2009
Location: Ontario, Canada
Posts: 55
Default

Quote:
Originally Posted by johnathon View Post
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.
KZS is offline   Reply With Quote
Old 02-04-2010, 02:00 PM   #14 (permalink)
Registered Member
 
Join Date: Aug 2009
Posts: 216
Default

Quote:
Originally Posted by KZS View Post
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
johnathon is offline   Reply With Quote
Old 10-04-2010, 07:56 AM   #15 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 3
Default

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
Destriarch is offline   Reply With Quote
Old 10-04-2010, 01:58 PM   #16 (permalink)
Indie Developer
 
iSDK's Avatar
 
Join Date: Jul 2010
Posts: 1,333
Send a message via AIM to iSDK
Default

Did you ever work out how to toggle wifi?
iSDK is offline   Reply With Quote
Old 10-05-2010, 06:49 AM   #17 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 3
Default

Quote:
Originally Posted by iSDK View Post
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
Destriarch is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 595
21 members and 574 guests
Andy8888, Arfan, armmzz, bignoggins, BrianSlick, ckgni, devangvyas, Duncan C, Hito_kun, kvu, learningtocode, linkmx, LiquidFire, MarcoAlmeida, Monstertaco, oceanlablight, soonw29, sudama, Vineesh
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,775
Threads: 89,203
Posts: 380,590
Top Poster: BrianSlick (7,129)
Welcome to our newest member, Andy8888
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 10:46 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0