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
Posts: 889
Registered: ‎08-31-2009
My Device: 9530, 9630, 9800, 8530, 9900, 9810, 9930, PlayBook, Dev Alpha
My Carrier: Verizon
Accepted Solution

Use invocation to share a file

Has anyone figured out how to share a file via invocation in cascades? If I do an unbound invocation I get the screen offering multiple invocation targets, but after selecting one, the invocation just closes without sharing anything. It is possible that I am formatting the uri incorrectly, but any working sample that anyone has would be appreciated.


Read my thoughts on BlackBerry Development at news.ebscer.com
Developer
Posts: 64
Registered: ‎09-10-2009
My Device: Z10, Bold 9700
My Carrier: O2 Germany

Re: Use invocation to share a file

Do you have the latest OS update for the Dev Alpha installed? I'm also using an unbound invocation for sharing and I just successfully tested sharing a PDF file from our app via email.

The file is stored in the home directory (data) of the local sandbox. I'm setting its "file:///..." uri and the MIME type on the InvokeActionItem. Do you have the correct MIME type set, e.g. application/pdf for a PDF file?
----

My Twitter: @hendrik_dev
Developer
Posts: 889
Registered: ‎08-31-2009
My Device: 9530, 9630, 9800, 8530, 9900, 9810, 9930, PlayBook, Dev Alpha
My Carrier: Verizon

Re: Use invocation to share a file

I have my MIME type set to 'text/html' the file I am trying to share is in the shared directory (which I can access if I manually attach a file to a new email). I set the uri in the format

uri: "file:///shared/misc/fileName.html"

 is this correct?


Read my thoughts on BlackBerry Development at news.ebscer.com
Developer
Posts: 64
Registered: ‎09-10-2009
My Device: Z10, Bold 9700
My Carrier: O2 Germany

Re: Use invocation to share a file

The MIME type is correct. But there is an error in your uri. You have to construct your uri this way:

"file://" + workingDir + "/shared/misc/fileName.html"

 You have to use C++ code to get the working directory:

QString workingDir = QDir::currentPath();

 

Have a look at this article for more details:

https://developer.blackberry.com/cascades/documentation/device_platform/filesystem/index.html

 

----

My Twitter: @hendrik_dev
Developer
Posts: 889
Registered: ‎08-31-2009
My Device: 9530, 9630, 9800, 8530, 9900, 9810, 9930, PlayBook, Dev Alpha
My Carrier: Verizon

Re: Use invocation to share a file

Thanks. That was the issue.

 

Now I just need to figure out how to dynamically set the uri...


Read my thoughts on BlackBerry Development at news.ebscer.com