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

Java Development

Reply
Developer
laurentC
Posts: 266
Registered: ‎02-05-2010
My Device: Blackberry Z10
Accepted Solution

BBM broadcastdata

Hi,

I'm working on a bbm connected app in wich I'm trying to create a session between bbm users and sharing data between them through the session.

I'm following the bbm dev guide to create a session :
MessagingService messagingService = _pluginContext.getMessagingService();
mySession = messagingService.createSession(new MySessionListener());

In the broadcastDataReceived method of MySessionListener, I'm just trying to display a Dialog box :
Dialog.inform("broadcasting msg from:" + sender.getDisplayName() + " > " + data.getDataAsString());

I'm running my app in the bbm simulators. They can communicate with each others, send/receive bbm messages, etc...
The session creation works well. When User1 send a session invitation to user2, user2 gets the invitation and accept it.

Now when I try to broadcastData (from user1 or user2), nothing happens. Here's my code :
mySession.broadcastData(new BBMPlatformData(data));

What am I missing ? I've searched the forum and find some kind of a solution to my problem : define a messaging service listener. But I can't figure out how to do that in the dev guide...

Please help.

Laurent

Twitter : @LaurentKP
My apps
Please use plain text.
Developer
alishaik786
Posts: 285
Registered: ‎08-26-2011
My Device: 9900

Re: BBM broadcastdata

See the sample "TicTac" demo which is provided along with BBMSDK1.0 or 2.0 version. Then you can understand.
=================================================================================
Feel free to click LIKE button if the solution helps you;
--
Regards,

ALI SHAIK.
Please use plain text.
Developer
peter_strange
Posts: 19,609
Registered: ‎07-14-2008
My Device: Not Specified

Re: BBM broadcastData

@alishaik786 - I don't think any of the supplied demo applications use broadcastData, so looking there won't help I suspect.

 

I am using these two methods (BroadcastData and broadcastDataReceived) in my applications and it is working fine.  Check that you session listener is properly configured is my only suggestion. 

 

Actually one more thing.  These methods are only officially in SDK 1.2 only I believe, so perhaps there is an issue if you try these methods but are using a BBM 6.0 on device or simulator, rather than BBM 6.1. 

 

 

Please use plain text.
Developer
laurentC
Posts: 266
Registered: ‎02-05-2010
My Device: Blackberry Z10

Re: BBM broadcastData

Hi Peter,

 

I can see BroadcastData and broadcastDataReceived in the bbm sdk 1.1 but you're right, maybe I could try to download the latest version of the bbm SDK (1.2).

 

 

Thanks anyway.

Twitter : @LaurentKP
My apps
Please use plain text.
Developer
peter_strange
Posts: 19,609
Registered: ‎07-14-2008
My Device: Not Specified

Re: BBM broadcastData

My mistake, it is in 1.1.  I've never tried it with that level. 

Please use plain text.
Developer
laurentC
Posts: 266
Registered: ‎02-05-2010
My Device: Blackberry Z10

Re: BBM broadcastdata

I looked at the bbm sdk examples and the tic tac toe example gave me the solution.
In BBMBridgeImpl.java, a new MessagingServiceListener is created to link MessagingService and Channel. I think that's the way we catch the broadcast datas sent through a session (or channel).

Here's my code (not tested for now) :

_messagingListener = new MessagingServiceListener() {
    public void channelCreated(BBMPlatformChannel channel) {                        
    }

    public void channelCreated(BBMPlatformChannel channel, int menuItemId) {                        
    }

    public BBMPlatformChannelListener getChannelListener(BBMPlatformChannel channel) {
        return null;
    }

    public void sessionCreated(BBMPlatformSession session) {
        mySession = session;
    }
    public void sessionEnded(BBMPlatformContact contact, BBMPlatformSession session) {
    }
    public BBMPlatformSessionListener getSessionListener(BBMPlatformSession session) {
        return mySessionListener;
    }

    public void fileTransferFailed(String path, BBMPlatformContact contact, int code) {
    }

    public void onContactReachable(BBMPlatformContact contact) {
    }
    public void onMessagesExpired(BBMPlatformContact contact, BBMPlatformData[] data) {
    }

    public void joinRequestAccepted(BBMPlatformOutgoingJoinRequest request, String param) {
    }

    public void joinRequestDeclined(BBMPlatformOutgoingJoinRequest request, int code) {
    }
};

I will do some test later and keep you in touch if it works.

Twitter : @LaurentKP
My apps
Please use plain text.
Developer
laurentC
Posts: 266
Registered: ‎02-05-2010
My Device: Blackberry Z10

Re: BBM broadcastdata

It works great !

Hope it can be helpful for others...

Twitter : @LaurentKP
My apps
Please use plain text.
Contributor
sandeepsagark
Posts: 41
Registered: ‎07-19-2011
My Device: 9500

Re: BBM broadcastdata

Hi LaurentC,

Shall you help how you have solved your problem with working on 2 simulators for testing.
Thank you
Please use plain text.