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
Developer
Posts: 259
Registered: ‎01-08-2013
My Device: Z10 LE
My Carrier: SiMobil
Accepted Solution

Invocation; phone number to text or call

On button click I would like to give user an option what to do with that phone number: to call or send a text message

 

Button {
    text: "Call"
    id: phoneNumber
    onClicked: {
        invoke.trigger("bb.action.OPEN")
    }
}

attachedObjects: [
    Invocation {
        id: invoke
        query {
            mimeType: "text/plain"
            data: "+38640111222"
        }
    }
]

 I'm not sure what mimeType should be for this action, and if I went completely the wrong way.

Retired
Posts: 81
Registered: ‎09-09-2013
My Device: BlackBerry Z10
My Carrier: Etisalat UAE

Re: Invocation; phone number to text or call

[ Edited ]

Hello,

Please check this link:

https://developer.blackberry.com/native/documentation/cascades/device_platform/invocation/phone.html


Thanks,
Kareem.

Kareem ELSayed | Application Development Consultant | Developer Relations | BlackBerry | Twitter:@kemobyte
Retired
Posts: 81
Registered: ‎09-09-2013
My Device: BlackBerry Z10
My Carrier: Etisalat UAE

Re: Invocation; phone number to text or call

Also as easy way to accomplish this:

 

 In your appUI.cpp / main, Include:

 

#include <bb/system/phone/Phone>
#include <bb/data/DataSource>

You would need to add LIBS += -lbbdata to the .Pro file.

 

Add these lines to register the system.phone and access it from QML:

 

    qmlRegisterType<bb::system::phone::Phone>("bb.system.phone", 1, 0, "Phone");
    DataSource::registerQmlTypes();

Then in the QML file: 

 

import bb.cascades 1.0
import bb.system.phone 1.0

Page {
    Container {
        horizontalAlignment: HorizontalAlignment.Fill
        verticalAlignment: VerticalAlignment.Fill
        Button {
            text: "Call Me!!"
            onClicked: {
                phone.initiateCellularCall("0038640111222");
            }
        }
    }
    attachedObjects: [
        Phone {
            id: phone
        }
    ]
}

 

Kareem ELSayed | Application Development Consultant | Developer Relations | BlackBerry | Twitter:@kemobyte
Highlighted
Developer
Posts: 259
Registered: ‎01-08-2013
My Device: Z10 LE
My Carrier: SiMobil

Re: Invocation; phone number to text or call

[ Edited ]

Well I thought it would ask me if I want to call or send SMS, but I suppose this should do.

 

However,

DataSource::registerQmlTypes();

 always gives me an error. Yes, I have both includes you provided, but even if i remove it, it still works with no errors

Retired
Posts: 81
Registered: ‎09-09-2013
My Device: BlackBerry Z10
My Carrier: Etisalat UAE

Re: Invocation; phone number to text or call

[ Edited ]

Hello,

Sorry I was copy pasting from old code Smiley Happy. However to fix the error you can add this line:

using namespace bb::data;

 

or instead append the namespace to the same line 

bb::data&colon;:DataSource::registerQmlTypes();

 

Thanks,
Kareem.

Kareem ELSayed | Application Development Consultant | Developer Relations | BlackBerry | Twitter:@kemobyte
Developer
Posts: 259
Registered: ‎01-08-2013
My Device: Z10 LE
My Carrier: SiMobil

Re: Invocation; phone number to text or call

Yup yup thanks, that was an obvious one.