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
BlackBerry Development Advisor
shaque
Posts: 237
Registered: ‎07-14-2008
My Device: Not Specified

Re: Share text message and email with subject.

Hi,
You can duplicate the BB World experience if you use invoke the email composer as documented in the following page.
https://developer.blackberry.com/cascades/documentation/device_platform/invocation/email.html

Shadid
Contributor
peevedoffdeveloper
Posts: 35
Registered: ‎03-04-2013
My Device: 9850

Re: Share text message and email with subject.

Sorry not following you. That url is a link for invoking the email composer.

 

I am interested in doing a share message for any app that can share a message with or without a subject field.  I hoped I can do a single invoke request that allows me to select the target type via the popup sheet and would handle text messages, bbm ,facebook, etc which does not use a subject and at the same time handle email messages and  in this case, populate the email subject field.

 

This appears to be what happens in the app world app when  I click on the share action.

 

If this can be done via email composer could you provide sample code.

 

I have had difficulty getting examples working from that page.

 

thanks.

 

 

BlackBerry Development Advisor
shaque
Posts: 237
Registered: ‎07-14-2008
My Device: Not Specified

Re: Share text message and email with subject.

[ Edited ]

Can you try:

 

action: "bb.action.SHARE",
uri: "http://appworld.blackberry.com/webstore/content/50611",
metadata: "{\"description\":\"THIS IS THE BODY\",\"subject\":\"THIS IS THE SUBJECT\"}"

 

Please make sure that you do not set any other parameters. It's an odd one and this is how bb world is doing it.

Developer
Robdob
Posts: 225
Registered: ‎01-31-2013
My Device: Developer

Re: Share text message and email with subject.

did anyone ever get this resolved?  I would like to obtain the same information myself..

 

thanks,



GeoYeo - Free Local classifieds - Built for Blackberry 10, if you like it please Rate It and Share it!
Developer
BrajeshSanodiya
Posts: 134
Registered: ‎08-03-2011
My Device: torch, Z10

Re: Share text message and email with subject.

[ Edited ]

Try This:-
    

add these library to .pro file

LIBS += -lbb
LIBS += -lbbsystem

 

 

then use this code

#include <bb/PpsObject>
#include <bb/system/InvokeManager> #include <bb/system/InvokeRequest> using namespace bb::system;

 

 

void InvokeEmail::sendEmail() {
	InvokeManager m_invokeManager;
	InvokeRequest request;
	request.setAction("bb.action.COMPOSE");
	request.setMimeType("message/rfc822");
	QVariantMap data;
	data["to"] = (QVariantList() << "you@gmail.com");
	data["subject"] = "This is a subject";

	data["body"] = "Hello there, things are great!";
	QString logpath = "/accounts/1000/shared/documents/test.pdf";
	QString logpathEncoded = QString(QUrl(logpath).toEncoded());
	qDebug() << "## LOG PATH: " + logpathEncoded;
	data["attachment"] = (QVariantList() << logpathEncoded);
	QVariantMap moreData;
	moreData["data"] = data;
	bool ok;
	request.setData(bb::PpsObject::encode(moreData, &ok));

	m_invokeManager->invoke(request);
}

 

void InvokeEmail::sendSMS() 
{
	InvokeRequest request;
	request.setTarget("sys.pim.text_messaging.composer");
	request.setAction("bb.action.COMPOSE" );
	request.setMimeType("application/text_messaging");

	QVariantMap data;

	data["to"] = 15850342922;
	data["body"] = "thank you";
	data["send"] = false;

	QVariantMap moreData;
	moreData["data"] = data;

	bool ok;

	request.setData(bb::PpsObject::encode(moreData, &ok));

	InvokeManager *invokeManager = new InvokeManager();
	invokeManager->invoke(request);
}

 

-----------------------------------------------------------------------
"Like" if you liked the post.
"Accept as Solution" if the post solves your question.
-----------------------------------------------------------------------
Developer
Robdob
Posts: 225
Registered: ‎01-31-2013
My Device: Developer

Re: Share text message and email with subject.

Hi thanks, actually I'm trying to find out the answer to the original question which was:

 

.......

Does anyone know how to share a text message like the way RIM is doing it with the app world app with the share action when looking at an app? I can invoke the invoke the sheet with the list of all the matching sources for the query however for email I would like to include a subject as well just like how it works in the app world app.

 

For text messages and bbm just get the body and email gets body and subject.

 

Right now I am using 

 

mimeType: "text/plain"

invokeActionId: "bb.action.share"

 

this is retrieving the correct results from the query.

 

but how to set the data.

 

I am just passing a text message like

data = "my text message"

 

should I be using a json string like this

 

{
  "subject": "Some punctuation. Symbol",
  "body" : "HI! Here is some more stuff."
}


GeoYeo - Free Local classifieds - Built for Blackberry 10, if you like it please Rate It and Share it!