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
Fermin
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.

Please use plain text.
Administrator
MSohm
Posts: 14,444
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
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.
Found a bug? Report it using Issue Tracker
Please use plain text.
Developer
ibarrera
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?

Please use plain text.
Developer
peter_strange
Posts: 19,601
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. 

Please use plain text.
New Contributor
supportcrealab
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

 

Please use plain text.
Developer
simon_hain
Posts: 16,042
Registered: ‎07-29-2008
My Device: Z10 LE
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
Please use plain text.
New Contributor
supportcrealab
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

 

Please use plain text.
Contributor
caojianhua1987
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 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 Device: Blackberry9780
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 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.

Please use plain text.