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

Native Development

Reply
Highlighted
New Developer
Posts: 9
Registered: ‎01-11-2013
My Device: BB10
My Carrier: Rogers
Accepted Solution

Bluetooth SPP connection suspended when screen turns off

Hello,

 

I have a weird behavior of my application connected to Bluetooth.

 

The Bluetooth portion of my app is the same as the bluetoothchatspp. The connection is done this way:

 

bt_device_init(BTControllerCallback);
bt_spp_init();

bt_spp_open(m_remoteAddress.toAscii().data(), (char *) SPP_SERVICE_UUID, false);

using

SPP_SERVICE_UUID as "00001101-0000-1000-8000-00805F9B34FB"

If I disable the screen timeout with this qml command "Application.mainWindow.screenIdleMode = 1" then I can send and receive data over SPP for hours.

 

Now if the screen times out, exactly 10s after the timeout (whatever the timeout settings is), the BT link is suspended meaning no data are sent and received. I measured this interval using the system timer and catching the appropriate signal with this command:

        connectResult = QObject::connect(bb::cascades::Application::instance(), SIGNAL(asleep()), this, SLOT(onAsleep()));

Once the screen is on again (doing a swipe for instance) then data transfer is resumed without breaking the BT link.

 

Is there any power saving feature suspending the BT SPP link when the screen if off?

 

I need to read continuously data from my sensors so I would need to disable this features.

BlackBerry Development Advisor
Posts: 249
Registered: ‎07-14-2008
My Device: Not Specified

Re: Bluetooth SPP connection suspended when screen turns off

Do you have the

<permission>run_when_backgrounded</permission>

 permission in your bar-descriptor?

New Developer
Posts: 9
Registered: ‎01-11-2013
My Device: BB10
My Carrier: Rogers

Re: Bluetooth SPP connection suspended when screen turns off

You saved my day!
Thanks so much. I did not know that this option was for an application running in full screen but with the screen off.