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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Contributor
Posts: 27
Registered: ‎07-26-2012
My Device: i dont have a blackberry device
My Carrier: i dont have a blackberry device

Invoke addcontact from qml

Dear All,

i have some problem during using bb.action.ADDTOCONTACT

i already use invoke open browser, email , and dial and its work well

but i can't use addtocontact

this is my code

 

onClicked: {
                //invoke.trigger("bb.action.OPEN")
                invokeQueryaddcontact.data = "087872183913"
                invokeQueryaddcontact.updateQuery()
            }
            attachedObjects: [
	           Invocation {
		        id: invokeaddcontact
		        property bool auto_trigger: false
		            query: InvokeQuery {
		                id: invokeQueryaddcontact
		                invokeTargetId: "sys.pim.contacts.app"
		                mimeType: "application/vnd.blackberry.string.phone"
		                //uri: "http://www.google.com"
		            }
					onArmed: {
					    if (auto_trigger)
					        trigger("bb.action.ADDTOCONTACT")
					    auto_trigger = true;
					    
					}
		        }
            ]

 please help me

best regards,
aditya eka putra (@abang_adit)
New Developer
Posts: 9
Registered: ‎01-22-2013
My Device: Playbook
My Carrier: Rogers

Re: Invoke addcontact from qml

I am also having trouble with bb.action.ADDTOCONTACT 

 

Trying to use it in C++

 

InvokeRequest cardRequest;
QVariantMap data = QVariantMap();

 

data["phone"] = m_formattedNumber;
cardRequest.setTarget("sys.pim.contacts.app");
cardRequest.setAction("bb.action.ADDTOCONTACT");
cardRequest.setMimeType("application/vnd.blackberry.string.phone");
QByteArray encData = PpsObject::encode(data);
cardRequest.setData(encData);
InvokeTargetReply* reply = m_invokeManager-> invoke(cardRequest);

 

Also tried the phone number not encoded:

 

cardRequest.setData(m_formattedNumber.toUtf8());

 

In either case I just get the card flashed on the screen then disappears with no error reported.  Can't find any examples or documentation except the one page that lists the invocation parameters (https://developer.blackberry.com/cascades/documentation/device_platform/invocation/contacts.html)

 

Help!

 

Thanks! 

 

 

 

 

Highlighted
Developer
Posts: 292
Registered: ‎07-25-2008
My Device: Passport

Re: Invoke addcontact from qml

Invoking the full contacts app to add a phone number, like you showed, is supposed to work.  However, when I've tried it, the contacts app actually crashes.  There is a bug written about this:

https://www.blackberry.com/jira/browse/BBTEN-1073

 

However, you can invoke the contacts card, with similar parameters, and it does work:

 

    bb::system::InvokeManager invokeManager;
    bb::system::InvokeRequest request;
    request.setTarget("sys.pim.contacts.card.picker");
    request.setAction("bb.action.ADDTOCONTACT");
    request.setMimeType("application/vnd.blackberry.string.phone");
    request.setData(m_formattedNumber.toUtf8());
    invokeManager.invoke(request);
New Developer
Posts: 9
Registered: ‎01-22-2013
My Device: Playbook
My Carrier: Rogers

Re: Invoke addcontact from qml

Thanks, works great now!  Your help is much appreciated in solving this perplexing issue!