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
vingilot
Posts: 224
Registered: ‎03-29-2012
My Device: 9900

Change Data, BBM invocation using a button

Hello all, using a button to send text over bbm, at the moment I have:

 

attachedObjects: [
Invocation {
id: invoke
query: InvokeQuery{
mimeType: "text/plain"
invokeTargetId: "sys.bbm.sharehandler"
invokeActionId: "bb.action.SHARE"
data: "This is some text to share."
}

}
]

and this is working well, but unlike my previous implementation using the invokeActionItem, this does not have an onTriggered method to update the data, and I am not sure how to do so. If someone could tell me the best way to accomplish this that would be terrific. Thanks!

Developer
vingilot
Posts: 224
Registered: ‎03-29-2012
My Device: 9900

Re: Change Data, BBM invocation using a button

I've been working with the setData() and updateQuery functions but they do not have the desired effect. The documentation on setData and updateQuery are fairly sparse but they seem self-explanatory, I have tried calling invoke.query.setData("sample") followed by invoke.query.updateQuery(), I am not sure if this is precisely how to implement them and suspect not as this does not work. Any information would be great, thanks again.

BlackBerry Development Advisor
shaque
Posts: 237
Registered: ‎07-14-2008
My Device: Not Specified

Re: Change Data, BBM invocation using a button

Hello,

Can you share your code for the InvokeActionItem approach? If you can attach a sample application along with that, that would be very helpful. 

 

Thanks.

New Developer
LeoNoblink
Posts: 25
Registered: ‎09-13-2012
My Device: Playbook, Z10, Z30, Q10, Q5

Re: Change Data, BBM invocation using a button

I have the same problem:

 

attachedObjects: [      
        Invocation {
            id: invoke
            query {
                mimeType: "text/plain"
                data: "TEXT TO SHARE"
                invokeTargetId: "sys.bbm.sharehandler"
                onQueryChanged: {
                    console.log("invocation change");
                    invoke.query.updateQuery()
                }
                onDataChanged: {
                    console.log("invocation data change");
                    invoke.query.updateQuery()
                }
            }
        }
    ]
    
    function shareBBM(){
        invoke.query.setData("NEW TEXT TO SHARE");
        invoke.query.updateQuery();
        invoke.trigger("bb.action.SHARE");
    }

 onQueryChanged and onDataChanged are triggered, but the data is not change.

 

Thanks!

___________________________________

I am in a strange new world...
New Developer
LeoNoblink
Posts: 25
Registered: ‎09-13-2012
My Device: Playbook, Z10, Z30, Q10, Q5

Re: Change Data, BBM invocation using a button

I found a solution, even if not optimal, it works ok.

 

attachedObjects: [      
        Invocation {
            id: invoke
            query {
                mimeType: "text/plain"
                invokeTargetId: "sys.bbm.sharehandler"
                onDataChanged: {
                    console.log("change data")
                }                   
            }
            onArmed: {
                if (invoke.query.data != "") {
                    invoke.trigger("bb.action.SHARE");
                }
            } 
        }
    ]
    
    property string txToShare: "TEXT TO SHARE";
    
    function shareBBM(){
        invoke.query.setData(txToShare);
        invoke.query.setInvokeTargetId("sys.bbm.sharehandler");
        invoke.query.updateQuery();
    }
    
    function shareFB(){
        invoke.query.setData(txToShare);
        invoke.query.setInvokeTargetId("Facebook");
        invoke.query.updateQuery();
    }
    
    function shareTW(){
        invoke.query.setData(txToShare);
        invoke.query.setInvokeTargetId("Twitter");
        invoke.query.updateQuery();
    }

 

___________________________________

I am in a strange new world...