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

Web and WebWorks Development

Reply
Regular Contributor
annuk
Posts: 82
Registered: ‎09-26-2012
My Device: Torch 9800
My Carrier: NA

Invocation Framework with webworks and bbui.

Hi,

 

I need to use the invocation framework for sharing in my app. I tried using the share target sample app provided on github.

 

I have successfully implemented the BBM but i want to invoke it using the framework. Has any one implemented it. From where can i get good samples for the same.

 

On sharing I want to open the list  BBM, BBM group, NFC, email, facebook, twitter etc. I want to use bb10's generic share.

How can it be done.

 

Regards,

Annuk

Please use plain text.
BlackBerry Development Advisor
chadtatro
Posts: 614
Registered: ‎10-01-2009
My Device: Z10
My Carrier: Bell

Re: Invocation Framework with webworks and bbui.

Hello,

 

I'm a little bit confused as to what you're asking.  The Share Targets sample does exactly what you're describing, no?

 

 

Chad Tetreault | App Development Consultant | BlackBerry Developer Relations | developer.blackberry.com | @chadtatro
Please use plain text.
Regular Contributor
annuk
Posts: 82
Registered: ‎09-26-2012
My Device: Torch 9800
My Carrier: NA

Re: Invocation Framework with webworks and bbui.

Hi,

Thanks for your reply.

Actually, I want to implement the invocation framework for sharing my card on fb, twitter and BBM.

Please use plain text.
BlackBerry Development Advisor (Retired)
erikjohnzon
Posts: 245
Registered: ‎09-21-2012
My Device: Q10
My Carrier: Virgin

Re: Invocation Framework with webworks and bbui.

Can you clarify this statement: "implement the invocation framework for sharing my card on fb"

 

Does this mean you want to share a picture? What is a "card". Is this a custom card you wish to make? I am also a bit confused by your request.

@erikjohnzon
erjohnson@blackberry.com
Please use plain text.
Regular Contributor
annuk
Posts: 82
Registered: ‎09-26-2012
My Device: Torch 9800
My Carrier: NA

Re: Invocation Framework with webworks and bbui.

Hi,

 

Thanks fior your reply.

 

I have an app which has a page which contains image and text. Now I want to share the whole page by using the invocation framework.

I am currently invoking fb, twitter and bbm individually. Now, on share I want to open the list of targets through which I can share and select one of them.

 

Can Image and data be shared together? Currently i am using the following code:

 

function shareData() {
	try {
		alert('in share data');
		var request = {
			action: 'bb.action.SHARE',
			type: 'text/plain',
			target_type: ["APPLICATION", "CARD"]
		};

		blackberry.invoke.query(request, function(response) {
			
			alert('GETTING RESPONSE');
			var targets = response[0].targets;
			var dataToAppend = '';

			console.log(targets);
			$('#shareList').empty();

			for(var i = 0; i < targets.length; i++) {
				alert('GETTING RESPONSE'+targets[i].key);
				var icon = 'file://' + targets[i].icon;
				var label = targets[i].label;
				var key = targets[i].key;

				dataToAppend += '<li onclick="shareDataTo(\'' + key + '\')"><div class="listImage"><img width="119px" height="119px" src="' + icon + '"/></div><div class="listText">' + label + '</div></li>';
			}

			$('#shareList').append(dataToAppend);
			shareShow();

		}, function(response) {});

	} catch(e) {
		alert(e);
	}
}


// share data to selected service ie. BBM,FB,Twitter etc
function shareDataTo(key) {
	alert('Sharing to: ' + key);

	try
	{
	blackberry.invoke.invoke({
		target: key,
		action: "bb.action.SHARE",
		type: "text/plain",
		data&colon;"HELLO SHARING USING BBM"
		//uri: "file://" + savedFilePath
	}/*
	, function() {
			//alert('in success');
		}, function() {//alert('in failure');}*/
	
	);
	}
	catch(Error)
	{
		alert('in error '+ Error);
	}

}

 Using the above code, text is shared succesfully, but I want to share image also along with it.

 

Regards,

Annuk

Please use plain text.
BlackBerry Development Advisor (Retired)
erikjohnzon
Posts: 245
Registered: ‎09-21-2012
My Device: Q10
My Carrier: Virgin

Re: Invocation Framework with webworks and bbui.

OKay, this is what I understand you wish to share the whole page, both image and text.

 

There are a couple issues with the code if you wish to do that:

 

1. Your request object uses a MIME type of 'text/plain'. If you wish to share image and text, you need to share something that is in fact both. The format of which you choose. I would suggest .html since it seems that is what you would like to share.

 

2. Same thing again on invoke. You invoke it with a mime type of type: "text/plain". Omit this field altogether. If you want to share the entire page then just send an invoke object like this:

 

blackberry.invoke.invoke({
		target: key,
		action: "bb.action.SHARE",
		uri: "file://" + savedFilePath
	}

See where that gets you. The framework doesn't specifically support and image + text format, unless you consider an .html page just that, which I would.

@erikjohnzon
erjohnson@blackberry.com
Please use plain text.