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
Rok
Contributor
Rok
Posts: 11
Registered: ‎01-25-2013
My Device: Developer

Sharing an image in Facebook

I'm trying to share a picture that's stored remotely on a server through Facebook.  I can share a locally stored picture using -

 

navigator_invoke_invocation_t *iRequest = NULL;
navigator_invoke_invocation_create(&iRequest);
navigator_invoke_invocation_set_action(iRequest, "bb.action.SHARE");
navigator_invoke_invocation_set_target(iRequest,"Facebook");

char cwd[PATH_MAX];
char file[PATH_MAX];
getcwd(cwd, PATH_MAX);
snprintf(file, PATH_MAX, "file://%s/app/native/assets/picture.png", cwd);
navigator_invoke_invocation_set_uri(iRequest,file);

navigator_invoke_invocation_send(iRequest);
navigator_invoke_invocation_destroy(iRequest);

 

However, it doesn't seem to work if I use a http:// as the URI

 

So, as an alternative I tried to load the image data from the server and to share it by replacing the set_uri command with

 

navigator_invoke_invocation_set_data(iRequest, data, dataLen);
navigator_invoke_invocation_set_type(iRequest, "image/jpeg");

 

 But that didn't work, either.

 

Has anyone successfully managed to share a picture either from a remote server or from image data in memory?  If so, can they point out where I'm going wrong please?

Please use plain text.