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
Posts: 3
Registered: ‎03-03-2010
My Device: Curve 8900
My Carrier: T-Mobile
Accepted Solution

bluetooth programming - 8900 to 9000

Hi,

 

I am trying to run the Bluetooth Demo sample program to transfer data from BB 8900 to BB 9000.

 

Bluetooth is enabled in both devices. Manually I have paired the devices.

 

When I run the BluetoothDemo sample program from BB 8900, the program does not recognize BB9000.

 

        //Determine if this BlackBerry model or simulator supports Bluetooth.
        if (BluetoothSerialPort.isSupported())
        {
            // Get the BluetoothSerialPortInfo.  Retrieves serial port information for
            // the currently paired devices.
            _portInfo = BluetoothSerialPort.getSerialPortInfo();
            int numServices = _portInfo.length;
            System.out.println("No. of devices found: "+numServices);

            //Create a MenuItem for each Bluetooth device we can connect to.
            for (int count = numServices - 1; count >= 0; --count)
            {
                String serviceName = _portInfo[count].getServiceName();
                System.out.println("serviceName: "+serviceName);
               
               {
                  System.out.println("Device Name"+_portInfo[count].getDeviceName());
                    DeviceMenuItem deviceMenuItem = new DeviceMenuItem("Connect to: " +

                             _portInfo[count].getDeviceName(), _portInfo[count]);
                    addMenuItem(deviceMenuItem);
                }
            }

            addMenuItem(_listenItem);
        }

 

 

Any help appreciated.

 

Thanks

BlackBerry Development Advisor
Posts: 15,784
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: bluetooth programming - 8900 to 9000

The sample needs to be open and listening for incoming connections when you pair so that the sample's service is exchanged during the handshake process.  Have you done that?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Highlighted
New Contributor
Posts: 3
Registered: ‎03-03-2010
My Device: Curve 8900
My Carrier: T-Mobile

Re: bluetooth programming - 8900 to 9000

Thanks Mark for your solution. I was in the impression that,  sample application can detect any existing paired devices and will list out them in menu, . I need to pair the devices while the sample application is running.

 

Looks like I need

 

1. Run the sample application in 9000, click on Listen for connections (and wait for connection)

2. In 8900, search & add the bluetooth device 9000 to pair them.

3. open sample application in 8900,  now I see the BB 9000 in the menu.

4. Click on Connect to BB 9000 to transfer data.

 

Thanks Mark for your help.

Contributor
Posts: 17
Registered: ‎08-20-2010
My Device: 9700
My Carrier: Orange - London

Re: bluetooth programming - 8900 to 9000

I just want to know if there is a way to get the bluetooth paired devices in blackberry?
iam using this code
BluetoothSerialPortInfo[] info = BluetoothSerialPort.getSerialPortInfo();log.info(" Bluetooth supported ");int numServices = info.length;
but numServices returns me a zero value. 
There are 2 devices paired, it must return 2, but gives a zero.
Kindly help
Bhuvana