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
Developer
Posts: 32
Registered: ‎09-03-2008
My Device: Not Specified

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.

BlackBerry Development Advisor
Posts: 15,814
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
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.
Problem solved? Click the Accept As Solution button.
Developer
Posts: 588
Registered: ‎05-29-2009
My Device: 9100

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?

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

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. 

New Contributor
Posts: 2
Registered: ‎12-09-2010
My Device: Bold 9700

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

 

Developer
Posts: 17,019
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
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.
@SimonHain on twitter
New Contributor
Posts: 2
Registered: ‎12-09-2010
My Device: Bold 9700

Re: Turn on/off Bluetooth programmatically

thank you

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

 

Contributor
Posts: 13
Registered: ‎06-24-2011
My Device: Blackberry9780
My Carrier: student

Re: Turn on/off Bluetooth programmatically

I don't found any api to close the BT,but this appSmiley FrustratedpuerPower can do this.

How to the 3rd app do this??

Contributor
Posts: 13
Registered: ‎06-24-2011
My Device: Blackberry9780
My Carrier: student

Re: Turn on/off Bluetooth programmatically

The application address:

 

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

New Contributor
Posts: 2
Registered: ‎10-28-2011
My Device: Bold
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.