blackberry/BB10-WebWorks-Framework

Invoke Application available

splatterb0y opened this issue · 11 comments

Is it possible to check if a invokable application is installed on the users device?

F.E.: Sharing with twitter is handled with a invoke of twitter, but If the user has no twitter application on his phone, the invoke gets lost. Is it possible to check if the application is installed to before being invoked?

Yes, use invoke.query

Hey @bryanhiggins can you lend me a hand and provide me with an example how to check if twitter and facebook are available?

@splatterb0y could you please post your query code? You should be able to find Facebook and Twitter with target type Application and type plain/text.

var request = {  
    action: "bb.action.SHARE",
    type:"text/plain"
};

blackberry.invoke.query(request, function(response) {console.log(response)}, function() {});

This is what I came up with but I am not sure how to get the availability of Facebook and Twitter. The only idea I have is to loop trough all the targets and check the label, which is a bit inefficient imo.

That worked for me. You will need to iterate through the targets to find the one you're after.

[Array[1]]
0: Array[1]
0: Object
action: "bb.action.SHARE"
default: "Facebook"
icon: "/usr/share/icons/bb_action_share.png"
label: "Share"
targets: Array[6]
0: Object
icon: "/apps/sys.socialconnect.facebook.testRel_ct_facebookfac08cf8/public/native/facebook_icon.png"
key: "Facebook"
label: "Facebook"
perimeter: "personal"
type: "CARD"

Iterate over all, why is there no paramter for just asking for facebook?

That is how the native invoke framework works. It will always be a small number of results and you can use a single query for both Facebook and Twitter.

Alright. Thank you @bryanhiggins

Hi,

Can someone let me know how to write single query for both Facebook and Twitter.

Thanks.

HI @bbsam,

These issues are actually designed to document errors with the WebWorks framework itself. Please post app development questions in the forums (http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/bd-p/browser_dev)

Additionally you can find samples for Facebook and Twitter as well as the invocation framework here - https://github.com/blackberry/BB10-WebWorks-Samples