BlackBerry Forums Support Community

BlackBerry Forums Support Community (http://www.blackberryforums.com/)
-   Developer Forum (http://www.blackberryforums.com/developer-forum/)
-   -   Bluetooth radio ON/OFF status (http://www.blackberryforums.com/developer-forum/178161-bluetooth-radio-off-status.html)

jobincantony 02-25-2009 06:19 AM

Bluetooth radio ON/OFF status
 
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

hrbuckley 02-25-2009 09:29 AM

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.

jobincantony 02-25-2009 10:23 AM

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.

hrbuckley 02-25-2009 05:56 PM

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.

jobincantony 02-26-2009 03:48 AM

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

hrbuckley 02-26-2009 07:34 AM

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.

jobincantony 02-27-2009 09:12 AM

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 :shock:

Any other useful method?

hrbuckley 02-27-2009 10:36 AM

You have a 4.0 device? I only go back to 4.1, sorry.

jobincantony 02-27-2009 01:27 PM

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 .


All times are GMT -5. The time now is 01:49 PM.

Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.