Invoke BBM Channels

 

If you haven't been living under a rock you will have probably heard of BlackBerry's new social network feature called BBM Channels!  It's a new fresh take on allowing people to post content and consumers to get in touch with that content.  Luckily, BlackBerry has provided a way for developers to link their channels, or other relevant channels, within their app.  This is how.

 

The project is attached at the end of this tutorial for your pleasure and to use as a starting point if you'd like.  But first I would like to highlight the main file we will be touching:

  • main.qml

 

Screenshots

 

 

main.qml

here is where we setup an app menu and place the BBM Channels invoke inside of it.  Add the following code to your main.qml under the main page brackets:

 
 
Menu.definition: MenuDefinition {
        actions: [
            
        ]
    }

Within the actions you place an action item where you can setup the BBM Channel invoke. This will allow you to name the action item as well as link it to an icon or image. Make sure to replace the uri code with your BBM Channel's ID...unless you want to check out yours truly (aka DJ BMO :P) Place the following code within the actions:

 
 
ActionItem {
                title: "BBM Channel"
                imageSource: "asset:///images/ic_bbm.png"
                attachedObjects: [
                    Invocation {
                        id: invokeBBMChannel
                        query {
                            invokeTargetId: "sys.bbm.channels.card.previewer"
                            invokeActionId: "bb.action.OPENBBMCHANNEL"
                            uri: "bbmc:C00119063"
                        }
                    }
                ]
                onTriggered: {
                    invokeBBMChannel.trigger("bb.action.OPENBBMCHANNEL")
                }
            }

At the end your code look like so:

 
 
import bb.cascades 1.0

Page {
    Menu.definition: MenuDefinition {
        actions: [
            ActionItem {
                title: "BBM Channel"
                imageSource: "asset:///images/ic_bbm.png"
                attachedObjects: [
                    Invocation {
                        id: invokeBBMChannel
                        query {
                            invokeTargetId: "sys.bbm.channels.card.previewer"
                            invokeActionId: "bb.action.OPENBBMCHANNEL"
                            uri: "bbmc:C00119063"
                        }
                    }
                ]
                onTriggered: {
                    invokeBBMChannel.trigger("bb.action.OPENBBMCHANNEL")
                }
            }
        ]
    }
    Container {
        //Todo: fill me with QML
        Label {
            // Localized text with the dynamic translation and locale updates support
            text: qsTr("Hello BBM") + Retranslate.onLocaleOrLanguageChanged
            textStyle.base: SystemDefaults.TextStyles.BigText
        }
    }
}

And there you are! You're ready to integrate your Channel and app!

 

Brandon Orr

Transportation Planner (University of Waterloo Graduate) & Blackberry 10 Developer (PinGuin App) part of the open source BB team.

Website: appworld.blackberry.com/webstore/vendor/65375/

Leave your comments

Post comment as a guest

0

People in this conversation

  • Guest (Duc Dau)

    Vietnam

    How to connect twitter?
    My code:
    ActionItem {
    title: "twitter"
    imageSource: "asset:///images/twitter.png"
    attachedObjects: [
    Invocation {
    id: invoketwitter
    query {
    invokeTargetId: "com.twitter.urihandler"
    invokeActionId: "bb.action.VIEW"
    uri: "twitter:connect:@DauDuc1"
    }
    }
    ]
    onTriggered: {
    invoketwitter.trigger("bb.action.VIEW")
    }
    }
    it not work? , please me, thank.

    Like 0 Short URL:
Subscribe to the official OSBB BBM Channel!

osbbchannelQR

C00013E89

Back to top