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
zezke
Posts: 1,004
Registered: ‎12-12-2010
My Device: Z10 (red Limited Edition)
Accepted Solution

Is it possible to share app specific data over BBM?

Hi,

 

I am currently writing a sort of task list manager. However I was considering the ability to share a task with BBM contacts. A contact who would receive such a task could click it and then add it to his own app.

 

Could this be done over BBM?

 

Thanks in advance.

-------------------------------------------
BlackBerry Certified Builder for Native Application Development -- Proud member of the Belgian BlackBerry Developer group
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!
Please use plain text.
Developer
ekke
Posts: 1,544
Registered: ‎04-08-2010
My Device: Z10 (red Limited Edition), Q10, Z30
My Carrier: Telekom.de, O2, Vodafone

Re: Is it possible to share app specific data over BBM?


zezke wrote:

Hi,

 

I am currently writing a sort of task list manager. However I was considering the ability to share a task with BBM contacts. A contact who would receive such a task could click it and then add it to his own app.

 

Could this be done over BBM?

 

Thanks in advance.


this can be done with BBM

but not with the current implementation on BB10

 

I got the info that in OS versions after Launch youÄll be able to send app-specific data with BBM

(as you can already do with BB OS 7)

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner http://vimeo.com/ekkescorner/videos
bb10-development: http://appbus.org Twitter: @ekkescorner
Please use plain text.
Developer
zezke
Posts: 1,004
Registered: ‎12-12-2010
My Device: Z10 (red Limited Edition)

Re: Is it possible to share app specific data over BBM?

Thanks ekke!

-------------------------------------------
BlackBerry Certified Builder for Native Application Development -- Proud member of the Belgian BlackBerry Developer group
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!
Please use plain text.
BlackBerry Development Advisor
MSohm
Posts: 14,673
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook

Re: Is it possible to share app specific data over BBM?

[ Edited ]

Streaming data from one application to another using BBM APIs is available for BBM on BlackBerry OS 5-7, but is not currently available on BlackBerry 10.  It's something we're looking into post launch.

 

But you could accomplish this using the invocation framework for your app.  You could create an InvokeActionItem that send a file with a custom extension/mime time over a BBM chat session in your app like this:

 

InvokeActionItem {
    title: "Share Image Over BBM"
    query {
        invokeTargetId: "sys.bbm.sharehandler"
        invokeActionId: "bb.action.SHARE"
        uri: "file:///accounts/1000/shared/misc/file.tsk"
    }
}

Your application would also need to register with the invocation framework as a handler for this extension/mime type.  Then when the user receives the file, they could click on it to open the taskj in your app.

 

Not as seamless as streaming directly from one application to another, but it could be easier for now than buliding your own server infrastructure.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Developer
ekke
Posts: 1,544
Registered: ‎04-08-2010
My Device: Z10 (red Limited Edition), Q10, Z30
My Carrier: Telekom.de, O2, Vodafone

Re: Is it possible to share app specific data over BBM?

cool idea, Mark,

 

will try this out as a workaround.

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner http://vimeo.com/ekkescorner/videos
bb10-development: http://appbus.org Twitter: @ekkescorner
Please use plain text.
Developer
zezke
Posts: 1,004
Registered: ‎12-12-2010
My Device: Z10 (red Limited Edition)

Re: Is it possible to share app specific data over BBM?

Thanks Mark, works like a charm.

 

Some code snippets to help my fellow developers here.

 

bar-descriptor.xml

 

<invoke-target id="com.endare.toodleten">
    <invoke-target-type>application</invoke-target-type>
    <invoke-target-name>ToodleTen</invoke-target-name>
    <icon>
        <image>icon.png</image>
    </icon>
    <filter>
        <action>bb.action.VIEW</action>
        <action>bb.action.OPEN</action>
        <mime-type>*</mime-type>
        <property var="exts" value="tsk"/>
        <property var="uris" value="file://,data&colon;//"/>
    </filter>
</invoke-target>

 InvokeActionItem:

 

InvokeActionItem {
    title: "Share"
    imageSource: "asset:///images/share.png"
    query {
        invokeTargetId: "sys.bbm.sharehandler"
        invokeActionId: "bb.action.SHARE"
        uri: "file:///accounts/1000/shared/misc/ToodleTen-Task.tsk"
    }
}

 And in my main app class:

 

//Invocation framework
invokeManager = new InvokeManager(this);
connect(invokeManager, SIGNAL(invoked(const bb::system::InvokeRequest&)), this, SLOT(onInvoked(const bb::system::InvokeRequest&)));
//DO NOT FORGET TO FREE invokeManager!

 

void ToodleTen::onInvoked(const InvokeRequest& invoke)
{
	qDebug() << "ToodleTen:: received invoke";
	QUrl uri = invoke.uri();
	qDebug() << "ToodleTen:: " << uri.toString();
	QFile file(uri.toLocalFile());
	if(file.open(QIODevice::ReadOnly))
	{
		QTextStream in(&file);
		QString xml;
		while(!in.atEnd())
		{
			xml = xml + in.readLine();
		}
		file.close();
		qDebug() << "ToodleTen:: received xml " << xml;
		QDomDocument doc;
		doc.setContent(xml);
		//... Process stuff here
	}
}

 

-------------------------------------------
BlackBerry Certified Builder for Native Application Development -- Proud member of the Belgian BlackBerry Developer group
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!
Please use plain text.
Super Contributor
JeffLemon
Posts: 440
Registered: ‎01-13-2011
My Device: Playbook

Re: Is it possible to share app specific data over BBM?

Im stuck with this.

 

I've added in:

 

InvokeManager* invokeManager = new InvokeManager(this);
	connect(invokeManager, SIGNAL(invoked(const bb::system::InvokeRequest&)), this, SLOT(onInvoked(const bb::system::InvokeRequest&)));

 To a class in my app.

 

I've added this to my bar descriptor:

 

 <invoke-target id="com.MyAppId">
  		<invoke-target-type>application</invoke-target-type>
  		<invoke-target-name>My App Name</invoke-target-name>
	  	<icon>
	    	<image>icon.png</image>
	  	</icon>
	  	<filter>
	        <action>bb.action.VIEW</action>
	        <action>bb.action.OPEN</action>
	        <mime-type>*</mime-type>
	        <property var="exts" value="tsk"/>
    	</filter>
	</invoke-target>

 

I was wondering how I can test if my app invokes from another app? I have a file on my phone called test.tsk. How can I load it to see if my app loads?

 

Thanks

--------------------------------------------------------------------------------------------------
BlackBerry Apps: Instruments | ARTPAD | Piano | Drums | Xylophone
Please use plain text.
BlackBerry Development Advisor
MSohm
Posts: 14,673
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook

Re: Is it possible to share app specific data over BBM?

If you've sent the file over BBM, on the recipient device click on the grey folder type icon in the BBM chat message that has the file transfer.  It should invoke the application registered to accept that file type.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.