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
Contributor
Semaphor
Posts: 11
Registered: ‎05-07-2013
My Device: Z10
Accepted Solution

Sharing file through InvokeActionItem only brings up NFC

The problem I'm seeing is that I have a file with a custom extension. When using the InvokeActionItem to share (bb.action.SHARE), I cannot get any other items other then NFC (BBM, email and so on are not available). The file, filename.xyz, just contains XML which my app handles when opened.

 

So, how can I fix this?

 

 

 

Code:

 

InvokeActionItem {
id: shareIPBtn
title: qsTr("Share IP")
ActionBar.placement: ActionBarPlacement.InOverflow
imageSource: "asset:///images/share.png"

query {
mimeType: "application/xml"
invokeActionId: "bb.action.SHARE"
}

onTriggered: {
data = ServerRepository.getServerFilePath(hostIPStr.text); // returns file name
}
}

Developer
ETitus
Posts: 54
Registered: ‎05-14-2013
My Device: LE Z10

Re: Sharing file through InvokeActionItem only brings up NFC

I am familiar with the problem.
Sharing asset files opens up the NFC interface. Sharing files that are stored somewhere else should not pose this problem.
Try to make sure your file name starts with "file://"

 

 

Don't forget to mark as solved and like my post if it helped out!
Developer
ETitus
Posts: 54
Registered: ‎05-14-2013
My Device: LE Z10

Re: Sharing file through InvokeActionItem only brings up NFC

Semaphor, did that solve your problem? If so, can you mark my post as solution?

Don't forget to mark as solved and like my post if it helped out!
Contributor
Semaphor
Posts: 11
Registered: ‎05-07-2013
My Device: Z10

Re: Sharing file through InvokeActionItem only brings up NFC

[ Edited ]

So the solution isn't quite as neat as I hoped it would be. When defining an InvokeActionItem query, the uri must point to a file that exists on the file system. The mime type is then used to figure out which medium the file can be sent through. 

 

This is definitely an undocumented requirement. What my code did was create the file to be transferred when InvokeActionItem->onTriggered() is called. This is because the contents of the file depend on what the InvokeActionItem was used on. Sharing A would result in a different file than sharing B.

 

Anyway, my workaround was to create an empty file just so that the InvokeAction query can be satisfied. When onTriggered() is called, then I write to that file and the file is sent through the chosen medium.

 

 

What I find frustrating was that the contents of the file has no bearing on what the InvokeActionItem does; that responsibility lies with the mime type. So, I ask, what is the point of checking if the file exists??