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
simon_hain
Posts: 16,113
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Access a shared file from invocation target

[ Edited ]

I integrated my application in the share menu for a specific file type.

I receive an email with an attachment of this file type and select share from the context menu.

 

For request.uri() i get

QUrl( "file:///accounts/1000/invoke/appname/xa0000000000123/mfs.mfs" ) 

 I am not allowed to open this file.

My invoke target in the bar-descriptor.xml currently looks like this (redacted with x):

<invoke-target id="x">     
   <invoke-target-name>x</invoke-target-name>
    <icon><image>logo.png</image></icon>
    <invoke-target-type>application</invoke-target-type>
     <filter>
       <action>bb.action.SHARE</action>
       <mime-type>*</mime-type>
       <property var="exts" value="x"/>
      </filter>
</invoke-target>

Can i specify a FileTransferMode in the definition? Or is there anything else i can do to access the file?

 

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
BlackBerry Development Advisor
shaque
Posts: 234
Registered: ‎07-14-2008
My Device: Not Specified

Re: Access a shared file from invocation target

Hi Simon,
Can you confirm is the target application in the <appname> section of the path actually the one trying to access the file?

Shadid
Please use plain text.
Developer
hendrik
Posts: 63
Registered: ‎09-10-2009
My Device: Z10, Bold 9700
My Carrier: O2 Germany

Re: Access a shared file from invocation target

I ran into the same problem when trying to integrate into the "Share contact" menu of the Contacts app:

 

<type>APPLICATION</type>
<filter>
   <action>bb.action.SHARE</action>
   <mime-type>*</mime-type>
   <property var="exts" value="vcf" />
</filter>

 

I also received a file URI in the form "file:///accounts/1000/invoke/appname/xa0000000000123/card.vcf", the file transfer mode was set to COPY_RW.

 

Interestingly when integrating into the share menu of an appointment in the Calendar app (*.vcs file), I received a file URI in the form "file:///accounts/1000/shared/.../appointment.vcs" with the file transfer mode set to PRESERVE.

 

According to http://developer.blackberry.com/cascades/reference/bb__system__filetransfermode.html PRESERVE delivers the file as-is, while COPY_RW creates a read-write copy of the file in the target's private inbox.

 

Further information about PRESERVE can be found at http://developer.blackberry.com/html5/api/blackberry.invoke.html#.FILE_TRANSFER_PRESERVE where it says:

Describes the file transfer mode where the provided URI is preserved as is. No box-2-box logic is applied

 

So it seems that COPY_RW is supposed to copy the file to the sandbox of the invoked application. But why isn't it possible to access the file then? Maybe the provided file URI cannot be used directly and must be modified in some way? But what exact kind of box-2-box logic has to be applied then?

----

My Twitter: @hendrik_dev
Please use plain text.
Developer
simon_hain
Posts: 16,113
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Access a shared file from invocation target

Yes, it's the app name, or rather the invocation target name I defined.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
simon_hain
Posts: 16,113
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Access a shared file from invocation target

My invoke target id is: packagename.config, with package name being the id in the bar-descriptor.

And this target id is used in the url of the invokerequest i get:

file:///accounts/1000/invoke/packagename.config/xa000000000013c/file.name

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Administrator
MSohm
Posts: 14,528
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: Access a shared file from invocation target

Need some more info to track this one down.  Can you capture logs and submit them to Issue Tracker?  Here is how:

 

  1. From the home screen of the BlackBerry device, click on the Help application.
  2. On a BlackBerry PlayBook swipe down from the top bezel, and select Support.  On a BlackBerry 10 Smartphone select  Support from the bottom menu.
  3. On a BlackBerry PlayBook select Log Submission. On a BlackBerry 10 smartphone select  Create Report.
  4. Enter the Incident Number in the corresponding field.
  5. Enter the Email Address used to open the support ticket with BlackBerry technical support in the corresponding field.
  6. On the BlackBerry PlayBook click Create Report, or Report on a BlackBerry 10 Smartphone.
  7. Follow KB26068 to enable Storage and Sharing.
  8. Connect the BlackBerry device to a PC and open the corresponding removable drive from Windows Explorer (for example, Z:\).
  9. Copy <Date><Time>-<incident_number>.pb log file located under Z:\documents\logs to the computer. The file name will look like YYYYMMDDhhmmss-INC0000xxxxxxxx.pb, for example 20110720193715-INC000012345678.pb
  10. Create a private Issue Tracker submission with that log file, referencing this thread.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Developer
simon_hain
Posts: 16,113
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Access a shared file from invocation target

[ Edited ]

Created a report with a made-up incident number and attached it to a private issue

https://www.blackberry.com/jira/browse/BBTEN-1200

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Administrator
MSohm
Posts: 14,528
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: Access a shared file from invocation target

Got them, thanks!
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
New Contributor
riclu
Posts: 2
Registered: ‎01-11-2013
My Device: DevAlphaB

Re: Access a shared file from invocation target

Any news on this?

 

I'm having the same problem. I'm trying to open an e-mail image attachment: The request.uri() is set to the jpg located in file:///accounts/1000/invoke/... and the file transfer mode is CopyReadOnly. If I try to open the file I get permission denied. However, if I set the image uri to a Cascades SystemToast "icon" property the toast is shown with the image rendered.

Please use plain text.
Developer
simon_hain
Posts: 16,113
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Access a shared file from invocation target

No updates on that. Strange behavior riclu, maybe the SystemToast has another permission set?
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.