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
New Developer
longmilk
Posts: 126
Registered: ‎06-09-2010
My Device: 9000
Accepted Solution

Get the number of an incoming call

Hi all,

As the Gold 10.2 SDK is released, they described in the changed log that:

 

ll.png

 

But in the SDK, I cannot find any property or function to get the number of icoming call. 

Do you have any suggestion or solution?

Thanks,

 

 

Please use plain text.
Developer
ekke
Posts: 1,519
Registered: ‎04-08-2010
My Device: Z10 (red Limited Edition), Q10, Z30
My Carrier: Telekom.de, O2, Vodafone

Re: Get the number of an incoming call

also failed to find something on this in documentation

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
International Development Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

Open Source Enthusiast
blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner
bb10-development: http://appbus.org Twitter: @ekkescorner
Please use plain text.
Developer
billbsb
Posts: 144
Registered: ‎03-25-2011
My Device: Playbook, Z10 L.E.

Re: Get the number of an incoming call

I can't find either.

 

All that goodness, new APIs, out on the wild ... untammed, unused.

Cheers!
Please use plain text.
New Developer
sunetos
Posts: 17
Registered: ‎07-21-2013
My Device: Q10

Re: Get the number of an incoming call

This has actually been working for me since the 10.2 beta1 release. The docs are here:

 

https://developer.blackberry.com/native/reference/cascades/bb__system__phone__phone.html?f=phone#fun...

Please use plain text.
Developer
simon_hain
Posts: 16,137
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: Get the number of an incoming call


sunetos wrote:

This has actually been working for me since the 10.2 beta1 release. The docs are here:

 

https://developer.blackberry.com/native/reference/cascades/bb__system__phone__phone.html?f=phone#fun...


and where do you read the number? callUpdated gives you a Call object, but i don't see a number attribute on it.

----------------------------------------------------------
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 Developer
longmilk
Posts: 126
Registered: ‎06-09-2010
My Device: 9000

Re: Get the number of an incoming call

I knew the callUpdated() but how can you get the number of incoming call, which method or property?
Please use plain text.
New Developer
sunetos
Posts: 17
Registered: ‎07-21-2013
My Device: Q10

Re: Get the number of an incoming call

From the docs on that same page, after a callUpdated or lineUpdated signal, the phone's "lines()" are populated. My code does something like this:

m_phone = new Phone(this);
bool res = QObject::connect(m_phone, SIGNAL(callUpdated(const bb::system::phone::Call&)), this, SLOT(onCallUpdated(const bb::system::phone::Call&)));

...

void ApplicationUI::onCallUpdated(const bb::system::phone::Call &call)
{
	CallType::Type callType = call.callType();
	CallState::Type callState = call.callState();

	if (callType != CallType::Outgoing) return;
	qDebug() << "Phone number:" << m_phone->activeLine().address();
}

 

Please use plain text.
New Developer
longmilk
Posts: 126
Registered: ‎06-09-2010
My Device: 9000

Re: Get the number of an incoming call

I returns your own phone number not the number of the incoming call

Please use plain text.
New Developer
sunetos
Posts: 17
Registered: ‎07-21-2013
My Device: Q10

Re: Get the number of an incoming call

Ack, you're right. I apologize for the misinformation. I tried this (and many variations) and it does not work despite the documentation saying it should:

 

void ApplicationUI::onCallUpdated(const bb::system::phone::Call &call)
{
	CallType::Type callType = call.callType();
	CallState::Type callState = call.callState();

	//if (callType != CallType::Outgoing) return;

	qDebug() << "gvbb call updated id: " << call.callId() << " type: " << callType << " state: " << callState;

	//if (callState == CallState::Connecting) {
	//if (callState == CallState::Incoming) {
	if (true) {
		bb::system::InvokeRequest request;
		request.setAction("bb.action.OPEN");
		request.setMimeType("application/vnd.blackberry.calllog.id");
		request.setData(QByteArray::number(call.callId()));
		//request.setData(QString(call.callId()).toUtf8());

		const InvokeTargetReply *reply = m_invokeMgr->invoke(request);
		if (reply) {
			QObject::connect(reply, SIGNAL(finished()), this, SLOT(processInvokeReply()));
			qDebug() << "reply finished? : " << reply->isFinished();
		} else {
			qWarning() << "Invoke Failed! Reply object is empty.";
		}
	}
}

void ApplicationUI::processInvokeReply()
{
	// Get the reply from the sender object
	bb::system::InvokeReply *reply = qobject_cast<bb::system::InvokeReply*>(sender());
	qDebug() << "invoke reply:" << reply->objectName() << " | " << reply->dynamicPropertyNames();
	reply->dumpObjectInfo();
	reply->dumpObjectTree();
}

 

Please use plain text.
New Developer
longmilk
Posts: 126
Registered: ‎06-09-2010
My Device: 9000

Re: Get the number of an incoming call

Who is responsible for the Document for the new SDK? Can you please explain this?

Please use plain text.