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: 102
Registered: ‎04-01-2014
My Device: BlackBerry10 Simulator
My Carrier: none

Open e-mail attachment with app

Hi,

 

I have an app that opens files and displays its content in the app. It works fine when I pick a file from the filebrowser inside the app (with filepicker).

It also works fine when I browse through the file browser of my blackberry and then click on a file. Then it also gets automatically opened via an InvokeRequest.

 

Now I also want to open a file from an attachment of an e-mail. But when I click on the attachment I get the message "No viewer available for 'filename'.

 

Does anyone know how I can tell my app to also open and display the file when I click on it as an e-mail attachment?

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Open e-mail attachment with app

You need to register your app for invocation for that file type...

 

http://developer.blackberry.com/native/documentation/cascades/device_platform/invocation/invocation_...


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 102
Registered: ‎04-01-2014
My Device: BlackBerry10 Simulator
My Carrier: none

Re: Open e-mail attachment with app

I did that. But I found some further information.

 

When I want to open a file from a folder of my blackberry I get the complete path from the uri.

 

When I select an file with the filepicker the uri gives me this:

 

m_uri = request.uri().toString();

//----

output: m_uri = "file:///accounts/1000-enterprise/shared/documents/TestProtocoll.file"

 

In this case I remove everything before "/shared..." and give this to my function which opens the file, reads it and presents the data in my app like it's supposed to. And with that path ("shared/documents/TestProtocoll.file") it opens the file properly.

 

But when I want to open a file directly by clicking on the attachment of an e-mail I get this directory

m_uri =  "file:///accounts/1000-enterprise/invoke/de.my.app.reader.card.previewer/xa000000000013d/TestProtocol(1).file" 

 If I give the complete string to my app of course it can't find the file. But when I do exactly the same as when I open a file by picking a file from the filebrowser it also doesn't open. By exactly the same I mean again removing "file:///account/1000-enterprise/" from the string.

 

Does anyone have an idea how I can give my app the correct path to a file opened from an attachment of an e-mail.

 

I gave the app permission to "Email and PIN Messages" in my bar-descriptor.xml". So it can't be a missing permission to read it, can it?