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
Highlighted
Developer
Posts: 31
Registered: ‎07-25-2013
My Device: Q10
My Carrier: Vinaphone
Accepted Solution

Share multiple files via email & Invocation vs InvokeManager

Hi,

Sorry for the long post, actually I can invoke multiple files sharing using method 2 but I don't know what's wrong with method 1. Would like to here your suggestion/advice/explanation about this.

 

Method 1: I use Invocation to share multiple files via email following the guide here:

https://developer.blackberry.com/native/documentation/cascades/device_platform/invocation/email.html

However I cannot get it to work.

My Page is:

Page {
    id: mainPage
    attachedObjects: [
        Invocation {
            id: emailShare
            query {
                invokeTargetId: "sys.pim.uib.email.hybridcomposer"
                invokeActionId: "bb.action.SHARE"
                uri: "list://"
                data: "[{\"uri\": \"/accounts/1000/shared/downloads/test.txt\"},{\"uri\": \"/accounts/1000/shared/downloads/test.txt.1\"}]"
                mimeType: "filelist/mixed"
            }
         
        }
    ]

    Container {
        Button {
            text: "Share"
            onClicked: {
                emailShare.trigger(emailShare.query.invokeActionId);
            }
        }
    }
}

 When I run app, it output these error to console, then when I click the button nothing happen.

InvocationWrapper::onQueryFinished: no matching result from Menu Service for query
   mimeType="filelist/mixed"
   uri=QUrl("list://") 
   data= "[{"uri": "/accounts/1000/shared/downloads/test.txt"},{"uri": "/accounts/1000/shared/downloads/test.txt.1"}]" 
   metadata= QMap() 
   perimeter= 0 
   action= "bb.action.SHARE" 
   target= "sys.pim.uib.email.hybridcomposer" 
   invokerIncluded= false 
InvocationPrivate::onQueryResolved: no result matching query, no armed signal sent. 

Method 2: If I change to use InvokeManager like mentioned here:

http://supportforums.blackberry.com/t5/Native-Development/multiple-attachment-in-email/m-p/2349473#M...

Then it works, app can invoke email to share multiple files.

 

Page {
    id: mainPage
    Container {
        Button {
            text: "Share"
            onClicked: {
                _appUI.share();
            }
        }
    }
}
void ApplicationUI::share() {

    QString fileList = "[{\"uri\": \"/accounts/1000/shared/downloads/test.txt\"},{\"uri\": \"/accounts/1000/shared/downloads/test.txt.1\"}]";
    InvokeRequest invokeRequest;
    invokeRequest.setTarget("sys.pim.uib.email.hybridcomposer");
    invokeRequest.setAction("bb.action.SHARE");
    invokeRequest.setUri("list://");
    invokeRequest.setData(fileList.toUtf8());
    invokeRequest.setMimeType("filelist/mixed");
    mInvokeManager->invoke(invokeRequest);
}

 

 

My questions are:

1. What's different between 2 methods?

2. Why using Invocation gives error with Menu Service & InvocationWrapper? In this case do I need to register something with Menu Service to make it work?

 

Best regards,

 

 

Retired
Posts: 249
Registered: ‎07-14-2008
My Device: Not Specified

Re: Share multiple files via email & Invocation vs InvokeManager

Can you try prefixing the URIs with file://? 

[
   {
      "uri": "file:///path/to/file"     
   },
   ...
]
Developer
Posts: 31
Registered: ‎07-25-2013
My Device: Q10
My Carrier: Vinaphone

Re: Share multiple files via email & Invocation vs InvokeManager

Hi shaque,

It does not help.

Using Invocation, having file:// or not it still doesn't work

Using InvokeManager, it works for both cases: with file:// and without it

Retired
Posts: 249
Registered: ‎07-14-2008
My Device: Not Specified

Re: Share multiple files via email & Invocation vs InvokeManager

One last thing to try. Can you remove the target ID and leave everything else unchanged?

 

I just remembered that there is a known issue with Invocation wrapper APIs where if you specify target ID, it does not work.

 

Shadid

Developer
Posts: 31
Registered: ‎07-25-2013
My Device: Q10
My Carrier: Vinaphone

Re: Share multiple files via email & Invocation vs InvokeManager

Removing target ID makes it works!
Thanks shaque