qmlblackberry-10blackberry-cascadesbb-messenger

Add a contact/pin to BBM from BB 10 Native App


In my BB 10 cascades App , I need to add a Button click listener for Adding a contact information like pin:210000A to Blackberry Messenger (BBM). for that I am doing the following...

main.qml is like

import bb.cascades 1.0

Page {
Container {
layout: DockLayout {
}
TextArea {
    id: pinEditor
    hintText: "Enter PIN to invite"
    onTextChanged: {
        inviter.pin = text
    }
    input.submitKey: SubmitKey.Send
}

Inviter {
    id: inviter
    horizontalAlignment: HorizontalAlignment.Center
    verticalAlignment: VerticalAlignment.Center
}

} }

and Inviter.qml is like import bb.cascades 1.0

Container {
property string pin
Button {
text: "Invite to BBM"
onClicked: {
    query.uri = "pin:" + pin
    invoke.trigger("bb.action.INVITEBBM")
}
}
 attachedObjects: [
    Invocation {
    id: invoke
    query: InvokeQuery {
        id: query
        invokeTargetId: "sys.bbm.sharehandler"
        onQueryChanged: {
            invoke.query.updateQuery()
        }
    }
}

but I am getting "Read only property cannot be set"error in Qml.I have also added

LIBS += -lbbplatformbbm LIBS += -lbbsystem and BBM Permission in "bar-descriptor.xml" Do I need to Register with BBM for Adding contact in BBM from my App? and how to fix the above error?

Please help,

Thanks


Solution

  • I'm guessing here, but try this way:

    Container {
        property string pin
        Button {
            text: "Invite to BBM"
            onClicked: {
                invoke.query.setUri("pin:" + pin)
                invoke.trigger("bb.action.INVITEBBM")
            }
        }
        attachedObjects: [
            Invocation {
                id: invoke
                query {
                    invokeTargetId: "sys.bbm.sharehandler"
                    onQueryChanged: {
                        invoke.query.updateQuery()
                    }
                }
            }
        ]
    }