02-05-2013 04:01 AM
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
02-05-2013 10:18 AM
Hello,
I'm a little bit confused as to what you're asking. The Share Targets sample does exactly what you're describing, no?
02-06-2013 03:27 AM
Hi,
Thanks for your reply.
Actually, I want to implement the invocation framework for sharing my card on fb, twitter and BBM.
02-06-2013 03:46 PM
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.
02-07-2013 12:11 AM
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:"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
02-07-2013 11:17 AM
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.