Skip to content

Instantly share code, notes, and snippets.

@40
Created April 7, 2013 02:34
Show Gist options
  • Save 40/5328649 to your computer and use it in GitHub Desktop.
Save 40/5328649 to your computer and use it in GitHub Desktop.
Make Call in BB10
LIBS += -lbbsystem
//in the header
#include <bb/system/phone/Phone>
....
// remember to set the context property to somethin
QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
// place it after the above line
qml->setContextProperty("appcontext", this);
//create a new method below
void App::makecall(QString number){
bb::system::phone::Phone phone;
phone.initiateCall(number);
}
//add this line
public:
Q_INVOKABLE void makecall(QString number);
Button{
text: "Make call"
onClicked: {
//replace the number with whatever number you're calling
appcontext.makeCall("4151231234");
// ^ ^ ^ ---------------------------------- this is the argument from the method its QString.
// - - This is the method name in your cpp file
// -
// - This is the qml.setContextProperty name
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment