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
Super Contributor
Posts: 253
Registered: ‎08-19-2010
My Device: BB10, Playbook, 9900, 9800, 9700, 9550, 9530, 9500, 8700.
My Carrier: TT

Running bluetooth example has many problems.

[ Edited ]

Bluetooth examples do not work well.

 

Issue 1:

Device and OS: OS 5.0.0.862 with BB 9700 or OS 6.0.0.600 with BB 9800 or OS 7.0.0.585 with BB 9900.

Program name:Bluetoothdemo

Problem: On menu list, "Connect to: " doesn not show up.

The issue probably suffer the code at below, but I do not know how to modifty or correct the code.

 

_portInfo = BluetoothSerialPort.getSerialPortInfo();
int numServices = _portInfo.length;

// Create a MenuItem for each Bluetooth device we can connect to.
for (int count = numServices - 1; count >= 0; --count)
{
String serviceName = _portInfo[count].getServiceName();

if (serviceName.equals("Hi there") || serviceName.equals("COM X"))
{
DeviceMenuItem deviceMenuItem = new DeviceMenuItem("Connect to: " + _portInfo[count].getDeviceName(), _portInfo[count]);
addMenuItem(deviceMenuItem);
}
}

 

Issue 2:

Device and OS: OS 5.0.0.862 with BB 9700 or OS 6.0.0.600 with BB 9800 or OS 7.0.0.585 with BB 9900.

Program name:BluetoothSerialPortDemo

Problem: No MenuItem(copyContents). What's the function of the program?

              For example, the BluetoothDemo can send and receive text on the screen.

The issue probably suffer the code at below, but I do not know how to modifty or correct the code.

private final class BluetoothDemoScreen extends MainScreen
{
/**
* @see net.rim.device.api.ui.container.MainScreen#makeMenu(Menu,int)
*/
protected void makeMenu(Menu menu, int instance)
{
if (_infoField.getTextLength() > 0)
{
MenuItem copyContents = new MenuItem(new StringProvider("Copy Contents"), 0x230010, 0);
copyContents.setCommand(new Command(new CommandHandler()
{
/**
* @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata, Object)
*/
public void execute(ReadOnlyCommandMetadata metadata, Object context)
{
Clipboard.getClipboard().put(_infoField.getText());
}
}));
addMenuItem(copyContents);
}

super.makeMenu(menu, instance);
}

/**
* Prevent the save dialog from being displayed
*
* @see net.rim.device.api.ui.container.MainScreen#onSavePrompt()
*/
public boolean onSavePrompt()
{
return true;
}

/**
* @see net.rim.device.api.ui.Screen#close()
*/
public void close()
{
onExit();
super.close();
}
}

 

 

 

-Fight with BB10
Super Contributor
Posts: 253
Registered: ‎08-19-2010
My Device: BB10, Playbook, 9900, 9800, 9700, 9550, 9530, 9500, 8700.
My Carrier: TT

Re: Running bluetooth example has many problems.

[ Edited ]

Issue 1 is solved.

 

http://supportforums.blackberry.com/t5/Java-Development/bluetooth-programming-8900-to-9000/td-p/4635...

 

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.

 

 

MSohm Said that"

Note that the application should be listening for connections before you pair with your PC to ensure that the sample is listed in the available services that are exchanged during the pairing." It is a key solution for issue 1.


-Fight with BB10
Highlighted
Super Contributor
Posts: 253
Registered: ‎08-19-2010
My Device: BB10, Playbook, 9900, 9800, 9700, 9550, 9530, 9500, 8700.
My Carrier: TT

Re: Running bluetooth example has many problems.


lyon819 wrote:

Issue 1 is solved.

 

http://supportforums.blackberry.com/t5/Java-Development/bluetooth-programming-8900-to-9000/td-p/4635...

 

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.

 

 

MSohm Said that"

Note that the application should be listening for connections before you pair with your PC to ensure that the sample is listed in the available services that are exchanged during the pairing." It is a key solution for issue 1.




Bluetooth conneciton between BlackBerry device and laptop (device-initiated)

 

1.Install BluetoothDemo on BB device. 
2.Start BluetoothDemo, listen for connection. 
3.Paring BT device with computer on Bluetooth Connections. 
4.Make sure outcoming port shows Hi there. 
5.Open hypertrm.exe with outcoming port. 
4.Send text message testing from both side. Successful.

 

Good luck.

 


-Fight with BB10