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
Posts: 109
Registered: ‎02-09-2009
My Device: Not Specified

BlackBerryMessenger.getInstance() always returns null?

I am trying to catch BBM conversations, but the first thing I need to do is register my listener. However, every time I do BlackBerryMessenger.getInstance() I get null. This occurs both on the device (Tour running 5.0) as well as the simulator (4.7 Storm -- makes sense since no BBM installed..).

 

How can I get a refererence to the BBM instance? I know it is installed on my device since I use it regularly. I tried at various stages like start up of the device as well as waiting until the user launches the app.

 

Any ideas here? I checked out the TicTacToe demo, but if I can't even get a reference to the instance, not much else helps...

 

Thanks for your time and help guys!

Developer
Developer
Posts: 1,123
Registered: ‎02-10-2009
My Device: 8130 / 8350 / 9530 / 9550 / 9850 / PlayBook
My Carrier: Verizon

Re: BlackBerryMessenger.getInstance() always returns null?

Everything I have read says that you cannot get a general reference to the BBM application. You can only create your own instance to be able to transmit and catch messages from your own application.

Developer
Posts: 1,055
Registered: ‎01-25-2009
My Device: BlackBerry Bold 9650/BlackBerry Torch 9800

Re: BlackBerryMessenger.getInstance() always returns null?

[ Edited ]

This is a bug that I have filed with RIM in the issue tracker. Please vote on it so they can finally fix it:

 

https://www.blackberry.com/jira/browse/JAVAAPI-508

 

This has been an issue since BBM version 5 and has been a problem for one of my games since September (even before that since people started downloading the leaked versions). Not only that but it does return null when BBM is not installed. So its almost impossible to test on a simulator.

 

Also, I don't believe you can listen to conversations. I believe its just to use the BBM instance as a transport with the contact of the user's choice (Play the game with other bbm contact, share some information, etc.).

Jerome Carty - Follow jcarty on Twitter@jcarty | #webworks-dev / #BlackberryDev on irc.freenode.net | My Apps
Click "Accept as Solution" if post solved your original issue.. Give like/thumbs up if you feel post is helpful
Developer
Posts: 109
Registered: ‎02-09-2009
My Device: Not Specified

Re: BlackBerryMessenger.getInstance() always returns null?

I know everyone says you cant listen to conversations, yet I could list a bunch of apps that do, so its clearly possible.

 

Berry Buzz can detect incoming messages in BBM, but I would love to know how. Perhaps they approach it different with Consequence classes for profiles?

Developer
Posts: 1,055
Registered: ‎01-25-2009
My Device: BlackBerry Bold 9650/BlackBerry Torch 9800

Re: BlackBerryMessenger.getInstance() always returns null?

[ Edited ]

They are definitely using the Notifications APIs (which are set up for BBM). As far as I know, there is no way to listen in and get the content or text of an incoming or outgoing message for BBM.

Jerome Carty - Follow jcarty on Twitter@jcarty | #webworks-dev / #BlackberryDev on irc.freenode.net | My Apps
Click "Accept as Solution" if post solved your original issue.. Give like/thumbs up if you feel post is helpful
Developer
Posts: 109
Registered: ‎02-09-2009
My Device: Not Specified

Re: BlackBerryMessenger.getInstance() always returns null?

Thanks for the quick response. I tried to use the Notifications API after looking at the Notifications demo and other threads on here, but found no success. Were you able to get this going? Does anyone have some example code for catching BBM notifications?

Developer
Posts: 109
Registered: ‎02-09-2009
My Device: Not Specified

Re: BlackBerryMessenger.getInstance() always returns null?

Can anyone help me get started with the Notifications API in order to be notified when a new BBM comes in? Thanks!

Developer
Posts: 499
Registered: ‎06-24-2008
My Device: Not Specified

Re: BlackBerryMessenger.getInstance() always returns null?

Whatever the issues regarding conversations, BlackBerryMessenger.getInstance() still appears to be returning null under most circumstances.

 

Anyone hear any further on the JIRA ticket?

 

I tried to check JIRA but it isn't functioning this evening.

Developer
Posts: 1,055
Registered: ‎01-25-2009
My Device: BlackBerry Bold 9650/BlackBerry Torch 9800

Re: BlackBerryMessenger.getInstance() always returns null?

Previous issue is corrupted. New link:

 

https://www.blackberry.com/jira/browse/JAVAAPI-1231

 

I posted to this again in June with no response so I'm not sure what's going on.

Jerome Carty - Follow jcarty on Twitter@jcarty | #webworks-dev / #BlackberryDev on irc.freenode.net | My Apps
Click "Accept as Solution" if post solved your original issue.. Give like/thumbs up if you feel post is helpful