BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 02-25-2009, 05:19 AM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Jun 2008
Model: 9000
PIN: N/A
Carrier: Vodafone
Posts: 17
Post Thanks: 0
Thanked 0 Times in 0 Posts
Question Bluetooth radio ON/OFF status

Please Login to Remove!

Hi,

Is there any API for checking the Bluetooth radio ON/OFF status? or any API for enable the bluetooth?

I am developing a bluetooth application with auto start on device startup feature. My application will try to open connection with the first paired BT device @ start-up. But the BT open activity was failed due to Bluetooth radio is OFF at the start-up.

But , if i use the API javax.bluetooth.DiscoveryAgent.startInquiry(), the device is asking to enable the bluetooth. So there may be an API retrieving the bluetooth status.

Please Help.

Jobin
Offline  
Old 02-25-2009, 08:29 AM   #2 (permalink)
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Post Thanks: 20
Thanked 77 Times in 68 Posts
Default

You can get the BT radio status, but the best you can do is to get the system to ask the user to enable BT as you have seen. There doesn't seem to be any way to turn the BT radio on without user action, probably for security.
Offline  
Old 02-25-2009, 09:23 AM   #3 (permalink)
Knows Where the Search Button Is
 
Join Date: Jun 2008
Model: 9000
PIN: N/A
Carrier: Vodafone
Posts: 17
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for your quick reply.
could you please tell me how can we get the status?
Actually the BT radio was turned on before the device going to soft reset/hard reset. So the device will turn on the BT radio automatically after the reset. but my application is trying to open the BT connection before the BT radio was turned on by the starting process.
Offline  
Old 02-25-2009, 04:56 PM   #4 (permalink)
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Post Thanks: 20
Thanked 77 Times in 68 Posts
Default

Ah ok see your need. I'm away from my code base and can't remember if I use an API call, or a connection failure to find out if the radio is off but have a look at:
javax.bluetooth.LocalDevice.isPowerOn()

The documentation is kind of thin, but the name is promising.
Offline  
Old 02-26-2009, 02:48 AM   #5 (permalink)
Knows Where the Search Button Is
 
Join Date: Jun 2008
Model: 9000
PIN: N/A
Carrier: Vodafone
Posts: 17
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you... i can get the status with javax.bluetooth.LocalDevice.isPowerOn().

But How can we instruct the blackberry device to Turn ON the bluetooth radio?

Currently i found that, if the BT radio is turned off and user make a call on javax.bluetooth.DiscoveryAgen.StartInquiry(), the Blackberry will POP -up a message " The Application name requires bluetooth to be enabled. Enable Bluetooth? yes | No.


Actually i am searching for a function to do the same. ( i don't want to search the bluetooth devices in range... coz i already have paired devices:smileymad: )

Jobin
Offline  
Old 02-26-2009, 06:34 AM   #6 (permalink)
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Post Thanks: 20
Thanked 77 Times in 68 Posts
Default

I don't think there is a way for a third party app to turn Bluetooth on. The best you can do is call StartINquiry() and hope the user will agree to turn it on. Bluetooth is a suspect technology in the Blackberry world, there are lots of ways it has been used to attack mobile phones.
Offline  
Old 02-27-2009, 08:12 AM   #7 (permalink)
Knows Where the Search Button Is
 
Join Date: Jun 2008
Model: 9000
PIN: N/A
Carrier: Vodafone
Posts: 17
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok..

by the way Is there any method to get the Bluetooth radio ON/OFF status in OS V 4.0.2?

I have tried to make an API call

BluetoothSerialPort.getSerialPortInfo()

It will thrown an exception if the BT is turned off and working in some models with OS v up to 4.2.

But it will not thrown an exception even if the BT was turned OFF in BB perl with OS v 4.2.1

Any other useful method?
Offline  
Old 02-27-2009, 09:36 AM   #8 (permalink)
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Post Thanks: 20
Thanked 77 Times in 68 Posts
Default

You have a 4.0 device? I only go back to 4.1, sorry.
Offline  
Old 02-27-2009, 12:27 PM   #9 (permalink)
Knows Where the Search Button Is
 
Join Date: Jun 2008
Model: 9000
PIN: N/A
Carrier: Vodafone
Posts: 17
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

ok. I think javax.bluetooth has been introduced from v4.2.1.
So i need to take care it without this. it would be helpful if u could have a solution for this in 4.1 os.

thank you .
Offline  
Closed Thread


Thread Tools

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

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





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.