Welcome to the Official BlackBerry® Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Developer
Fermin
Posts: 32
Registered: 09-03-2008

Turn on/off Bluetooth programmatically

Hi,

 

Is it possible to turn on/off the bluetooth connection programmatically via the API?  I've had a look through the API and can't  find anything that would do this although I could be missing something.

 

Any help much appreciated.

Please use plain text.
Administrator
MSohm
Posts: 11,465
Registered: 07-09-2008
My Carrier: Bell

Re: Turn on/off Bluetooth programmatically

There are no APIs to programmatically enable or disable Bluetooth.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Found a bug? Report it using the Issue Tracker
Please use plain text.
Developer
ibarrera
Posts: 570
Registered: 05-29-2009

Re: Turn on/off Bluetooth programmatically

But I have seen applications which ask you to turn it on and they really do it. How is this possible?

Please use plain text.
Developer
peter_strange
Posts: 14,614
Registered: 07-14-2008

Re: Turn on/off Bluetooth programmatically

They don't turn it on.  They use Device Discovery, and the API asks to turn BlueTooth on if you don't have it on.  So this is not directly program controlled. 

Please use plain text.
New Contributor
supportcrealab
Posts: 2
Registered: 12-09-2010

Re: Turn on/off Bluetooth programmatically

Any update on this topic?

We need to control by code the switch off (and on) of BT.

Any partner program or private API to request in order to resolve this?

Thank You very much.

Stefano

CREALAB

 

Please use plain text.
Developer
simon_hain
Posts: 10,780
Registered: 07-29-2008
My Carrier: O2 Germany

Re: Turn on/off Bluetooth programmatically

welcome to the support forums.

 

no, there is no code for this.

rim usually does not grant access to any restricted APIs (and i have never heard of a case).

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.

peter_strange wrote:
"This process should happen traumatically for you in both JDE and Eclipse."
Please use plain text.
New Contributor
supportcrealab
Posts: 2
Registered: 12-09-2010

Re: Turn on/off Bluetooth programmatically

thank you

it is a pity - we loose opportunities about some Business application

 

Please use plain text.
Contributor
caojianhua1987
Posts: 13
Registered: 06-24-2011
My Carrier: student

Re: Turn on/off Bluetooth programmatically

I don't found any api to close the BT,but this app:smileyfrustrated:puerPower can do this.

How to the 3rd app do this??

Please use plain text.
Contributor
caojianhua1987
Posts: 13
Registered: 06-24-2011
My Carrier: student

Re: Turn on/off Bluetooth programmatically

The application address:

 

http://cn.blackberryinsight.com/tag/wi-fi/

Please use plain text.
New Contributor
gmariaandrea
Posts: 2
Registered: 10-28-2011
My Carrier: Vodafone

Re: Turn on/off Bluetooth programmatically

I have found this code snippet that should turn BT on:

 

if (!LocalDevice.isPowerOn()) {
            try {
                LocalDevice.getLocalDevice().setDiscoverable(DiscoveryAgent.GIAC);

            } catch (BluetoothStateException e) {
                e.printStackTrace();
            }
        }

But it requires user interaction.

 

Is it possible to turn BT on/off programatically but without user interaction?

 

Thanks.

Please use plain text.