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
Posts: 85
Registered: ‎06-22-2013
My Device: N/A
My Carrier: N/A

Invoke SMS Composer

Hello Guys,

 

I want to Open the SMS Composer from my app, i am using this function to invoke the composer 

invokeSMS() {
	InvokeRequest request;
	request.setTarget("sys.pim.text_messaging.composer");
	request.setMimeType("application/text_messaging");
	request.setAction("bb.action.COMPOSE" );
	m_invokeManager->invoke(request);

}

 but nothing happens..

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Invoke SMS Composer

This thread may help with QML and C++ solutions...

 

http://supportforums.blackberry.com/t5/Native-Development/How-to-invoke-quot-Text-Messages-quot-app-...


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

Developer of stokLocker, Sympatico and Super Sentences.
Retired
Posts: 81
Registered: ‎09-09-2013
My Device: BlackBerry Z10
My Carrier: Etisalat UAE

Re: Invoke SMS Composer

[ Edited ]

Hello esam_tec.

 

the following code is working fine, it opens the SMS composer (Without any filled data): [Tested on BB10 OS 10.1 & 10.2]

 

  In ApplicationUI.hpp:

     Public: 
     Q_INVOKABLE void InvokeSmsComposer();
 
     private slots:
     void OnInvokeFinished();
  
  In ApplicationUI.cpp: 
  void ApplicationUI::InvokeSmsComposer()
{
		qDebug()<<"Invocation Start";
		InvokeRequest cardrequest;
		cardrequest.setTarget("sys.pim.text_messaging.composer");
		cardrequest.setMimeType("application/text_messaging");
		cardrequest.setAction("bb.action.COMPOSE" );

		InvokeManager invokemanager;
		InvokeTargetReply *reply = invokemanager.invoke(cardrequest);
		if(reply){
			connect(reply,SIGNAL(finished()),this,SLOT(OnInvokeFinished()));
		}else{
			qDebug()<<"Invocation Connecting Failed!!";
		}
}

void ApplicationUI::OnInvokeFinished(){
	InvokeTargetReply *reply =  qobject_cast<InvokeTargetReply*>(sender());
	if(reply->error()){
		qDebug()<< "Invoke Failed - Do something";
	}
	reply->deleteLater();
}

   in QML file:
      Button {
            text: "Invoke SMS "
            onClicked: {
            	app.InvokeSmsComposer();
            }
        }

* don't forget to call qml->setcontextproperty("app",this) so you can access "app" in qml and invoke the code. 

 

Hope this help.

 

Thanks,

Kareem.

 

Kareem ELSayed | Application Development Consultant | Developer Relations | BlackBerry | Twitter:@kemobyte