Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Contributor
markjefferyuk
Posts: 2
Registered: ‎12-31-2012
My Device: Blackberry Bold 9700

How do I connection to a Bluetooth handsfree device using JDE

I'm trying to write a very simple app that will check if my cars handsfree radio is in range and if it is connect to it. I can see the handsfree radio using DiscoveryAgent and can find the handsfree service. I can also get the connection URL which is "btspp://5453ED430AA1:1;authenticate=false;encrypt=false;master=false". I have tried to connect using "StreamConnection con =(StreamConnection)Connector.open(sURL);" in a seperate thread, which does not work. I have also tried using SocketConnection which also doesn't work. When I try "Connector.open(sURL)", the handsfree radio phone Icon flashes like it is trying to connect, but the connection doesn't hold. I thought this was going to be fair simple to achieve, but even after many hour's on google, I still can't work it out. Any advice on how to complete the connection using the connection string would be very greatfully received.
Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: How do I connection to a Bluetooth handsfree device using JDE

It's actually a serial connection, You need to get the port data from the bluetooth info first.

 

Did you review this RIM Bluetooth sample?

 

http://supportforums.blackberry.com/t5/Java-Development/Bluetooth-Demonstration/ta-p/447662

New Contributor
markjefferyuk
Posts: 2
Registered: ‎12-31-2012
My Device: Blackberry Bold 9700

Re: How do I connection to a Bluetooth handsfree device using JDE

Thanks for the quick reply. I started out thinking this was a serial connection, however when I call " BluetoothSerialPortInfo[] info = BluetoothSerialPort.getSerialPortInfo();" nothing is returned. The "info.length = 0", even though my handsfree radio is paired to my blackberry. Is there another way to get the serial connection info I need, or is there another way to connection. Basically I want to do the same thing that happen when I go to my bluetooth options, select my handsfree device, and select connect.