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
Developer
santito95
Posts: 133
Registered: ‎02-24-2013
My Device: BlackBerry Z10 LE
My Carrier: Telcel

How can I change the led color on incoming calls using LED API?

Hi friends.

 

Now I'm working to implement a simple function on my application, i need set (by user selection) any color of the led on incoming calls.

 

can you help me?

 

thanks

 

regards.

Please use plain text.
Developer
BBSJdev
Posts: 6,094
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: How can I change the led color on incoming calls using LED API?

Which bit are you having problems with the led bit or the incoming call?


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Please use plain text.
Retired
PBernhardt
Posts: 749
Registered: ‎12-16-2008
My Device: BlackBerry Z30
My Carrier: Bell

Re: How can I change the led color on incoming calls using LED API?

You can set the LED colour with the LED class: https://developer.blackberry.com/native/reference/cascades/bb__device__led.html

 

and get notified of incomming calls with the Phone class: https://developer.blackberry.com/native/reference/cascades/bb__system__phone__phone.html?f=phone#fun...

Paul Bernhardt
Application Development Consultant
BlackBerry
@PBernhardt

Did this answer your question? Please accept this post as the solution.
Found a bug? Report it to the Developer Issue Tracker
Please use plain text.
Developer
santito95
Posts: 133
Registered: ‎02-24-2013
My Device: BlackBerry Z10 LE
My Carrier: Telcel

Re: How can I change the led color on incoming calls using LED API?

[ Edited ]

Hi!

 

I was working on the following code:

 

void MyDeviceInfo::onCallUpdated(const bb::system::phone::Call &call)
{
	CallState::Type state = call.callState();
   Led *theLed = new Led();
   theLed->setColor(bb::device::LedColor::Blue);
   theLed->flash();
	    qDebug()<< "callState=" << state;

	    if (bb::system::phone::CallState::Connected == call.callState()) {
	        qDebug() << "call connected, do something ...";
	    }
	    if (state == 5)
	    {
             theLed->cancel();
             qDebug()<< "Call Disconnected";
             
	    }
}

 But..  theLed->cancel(); doesn't work correctly...

 

the led continue blinking while the application are working.

 

on The console i can see "Call Disconnected" so, the problem is only on Led cancel function.

 

I'm waiting your response.

 

Regards!

Please use plain text.
Retired
PBernhardt
Posts: 749
Registered: ‎12-16-2008
My Device: BlackBerry Z30
My Carrier: Bell

Re: How can I change the led color on incoming calls using LED API?

If you call cancel from, say, a button inside your app does it work? Might be something to do with it being a phone call.

Could be a bug. You could also try flash(1) or something.

Also, you should use Disconnected, rather than hard coding 5, as a best practice.

Paul Bernhardt
Application Development Consultant
BlackBerry
@PBernhardt

Did this answer your question? Please accept this post as the solution.
Found a bug? Report it to the Developer Issue Tracker
Please use plain text.
Developer
santito95
Posts: 133
Registered: ‎02-24-2013
My Device: BlackBerry Z10 LE
My Carrier: Telcel

Re: How can I change the led color on incoming calls using LED API?

Now I fixed it, but the led blink with the traditional red on the following secuence:

Selected color
Red color
Selected color
Red color

I need disable the red color from incoming calls

How can I disable it?
Please use plain text.
Retired
PBernhardt
Posts: 749
Registered: ‎12-16-2008
My Device: BlackBerry Z30
My Carrier: Bell

Re: How can I change the led color on incoming calls using LED API?

That may not be possible. The user would probably have to disable the LED alert for phone calls in the notifications setting.

You could log a feature request on the Developer Issue Tracker.
Paul Bernhardt
Application Development Consultant
BlackBerry
@PBernhardt

Did this answer your question? Please accept this post as the solution.
Found a bug? Report it to the Developer Issue Tracker
Please use plain text.
Developer
santito95
Posts: 133
Registered: ‎02-24-2013
My Device: BlackBerry Z10 LE
My Carrier: Telcel

Re: How can I change the led color on incoming calls using LED API?

Oh :smileysad:

I can't disable the led alert of phone calls programmatically?
Please use plain text.
Retired
PBernhardt
Posts: 749
Registered: ‎12-16-2008
My Device: BlackBerry Z30
My Carrier: Bell

Re: How can I change the led color on incoming calls using LED API?

I doubt it. Disabling phone alerts is generally something that it's best to leave in the user's hands. As I said, you could submit a feature request though. I am sure there has been one logged for notification control in general, but this is the first I've personally heard of one for just the LED.
Paul Bernhardt
Application Development Consultant
BlackBerry
@PBernhardt

Did this answer your question? Please accept this post as the solution.
Found a bug? Report it to the Developer Issue Tracker
Please use plain text.