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
Contributor
Nithrot
Posts: 14
Registered: ‎10-03-2011
My Device: 8520

BBM app message issue

[ Edited ]

Hi,

 

I am developing a chat app using the BBM 6.0 (SDK 1.1) and I have encountering a problem while I trying to listen to the sent messages in a special case.

 

I have a user that host a public session, a second user send a "sendJoinRequest" to the host and join perfectly to him with both receiving messages. But sometimes, when a third user try to join to the host, only the host receive the messages of third user in session. "session.getContactList.size()" on side of third user have only return 1 contact, the host, and not receive event "contactJoined" with type="CONTACT_BEFORE_ME", only receive "CONTACT_INVITING_ME" event. The host and second user receive the event "contactJoined" of sessionListener, thinking they have 2 user in session

 

Example:

 

User A host a public session

User B join user A -> both receiving messages

User C join user A -> Sometimes only A see messages of C and vice versa. B and C cant see each other.

 

I'm doing testing at physical devices, not on the simulator.

 

Any help is welcome!

Please use plain text.
Retired
rmasroor
Posts: 172
Registered: ‎06-07-2010
My Device: BlackBerry 8520

Re: BBM app message issue

Hey Nithrot,

 

 

Could you paste snippets of your code that I could have a look at how you are implementing your MessagingServiceListener and your BBMPlatformSessionListener.

 

Looking forward to your reply.

Raihan Masroor
BlackBerry Development Advisor
Please use plain text.
Contributor
Nithrot
Posts: 14
Registered: ‎10-03-2011
My Device: 8520

Re: BBM app message issue

Here my code:

 

- MessagingServiceListener

 

        public void sessionCreated(BBMPlatformSession s) {
            if (session != null && s != session) {
            	try{
            		session.leave();  // abandon the existing session
            	}catch(Exception e){
            		//Error
            	}
            }
            session = s;
        }
        
        public BBMPlatformSessionListener getSessionListener(BBMPlatformSession session) {
            return sessionListener;
        }

 - BBMPlatformSessionListener

 

public void contactLeft(BBMPlatformConnection connection,
				BBMPlatformContact contact) {
			String msg = "Session left";
	        MessageSender sender = new MessageSender(contact.getDisplayName());
	        TextMessage message = new TextMessage(msg, sender);
	        MessageFieldProvider field = new IncomingTextMessageField(message);
	        callback.onMessageReceived(field);//Write on chatField the message
		}

		public void contactsJoined(BBMPlatformConnection connection,
				BBMPlatformContactList contactList, String cookie, int type) {
			if(type == BBMPlatformSessionListener.CONTACT_INVITED_BY_ME || type == BBMPlatformSessionListener.CONTACT_INVITED_BY_OTHER){
				Enumeration e = null;
				String msg = "Joined to session";
				if(contactList != null){
					e = contactList.getAll();
				}
				while(e.hasMoreElements()){
					BBMPlatformContact contact = (BBMPlatformContact)e.nextElement();
					MessageSender sender = new MessageSender(contact.getDisplayName());
					TextMessage message = new TextMessage(msg, sender);
					MessageFieldProvider field = new IncomingTextMessageField(message);
					callback.onMessageReceived(field);//Write on chatField the message
				}
			}
		}
		
		public void broadcastDataReceived(BBMPlatformSession connection,
				BBMPlatformContact contact, BBMPlatformData data) {
			String msg = data.getDataAsString();
            MessageSender sender = new MessageSender(contact.getDisplayName());
            TextMessage message = new TextMessage(msg, sender);
            MessageFieldProvider field = new IncomingTextMessageField(message);
            callback.onMessageReceived(field);//Write on chatField the message
		}

        public void joinRequestReceived(BBMPlatformConnection connection, BBMPlatformIncomingJoinRequest request, String param) {
        	request.accept(null);  // automatically accept all public requests
        }

 Only paste the methods overridden by me

 

Thanks for the reply

Please use plain text.
Developer
meera_developer
Posts: 30
Registered: ‎02-02-2012
My Device: 9780

Re: BBM app message issue

Hi,

 

  I am new to BBM integrated app development. I need to list the complete BBM friends names in my application. PLease help me to do that.

 

Thanks and Regards,

  meera Manesh 

Please use plain text.
Retired
rmasroor
Posts: 172
Registered: ‎06-07-2010
My Device: BlackBerry 8520

Re: BBM app message issue

Hey Nithrot,

 

Apologies for the delay in my response. I'm still investigating your issue.

 

Will respond back asap.

 

Regards,

Raihan

Raihan Masroor
BlackBerry Development Advisor
Please use plain text.
Retired
rmasroor
Posts: 172
Registered: ‎06-07-2010
My Device: BlackBerry 8520

Re: BBM app message issue

Hey Meera,

 

You may want to use the ContactListService to retrieve the BBM users who have installed your application. http://www.blackberry.com/developers/docs/bbm/1.3.0api/net/rim/blackberry/api/bbm/platform/service/C...

 

Regards,

Raihan

Raihan Masroor
BlackBerry Development Advisor
Please use plain text.
Developer
meera_developer
Posts: 30
Registered: ‎02-02-2012
My Device: 9780

Re: BBM app message issue

What I mean is to get all BBM friends name. Not the contact names of the users who are installed my App.

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

Re: BBM app message issue

"What I mean is to get all BBM friends name"

 

Not possible - the only names you can get in your application are those contacts that have your application.  This is 'feature' in BMM, I believe as an anti-spamming measure. 

Please use plain text.