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
Regular Contributor
Posts: 74
Registered: ‎01-12-2012
My Device: Developer

integrating BBM in my app ???

Hello, all help is apprecaited ...
I used the code found here http://docs.blackberry.com/en/developers/deliverables/34924/Register_your_app_with_the_BBM_Platform_...

and even tested BBSDKDEMO sample..
I always end up with the same result. The simulator runs but never installs the app.

I am using Blackberry JRE 7.1 and and I have jdk1.6.0_24 and I inserted the UUID using :
private final static String UUID = String.valueOf(UIDGenerator.getUID());

I have added this to the lib file BBMPlatformApp/lib/net_rim_bb_qm_platform.jar in my app.

Application displays no errors...
 

Thank you all... 

Developer
Posts: 887
Registered: ‎08-31-2009
My Device: 9530, 9630, 9800, 8530, 9900, 9810, 9930, PlayBook, Dev Alpha

Re: integrating BBM in my app ???

There are specific simulators (and MDS) that you need to run for testing BBM connected apps.


Read my thoughts on BlackBerry Development at news.ebscer.com
Regular Contributor
Posts: 74
Registered: ‎01-12-2012
My Device: Developer

Re: integrating BBM in my app ???

Thank you for the reply ...

I followed setting up the enviroment from this link :
http://us.blackberry.com/developers/blackberrymessenger/ 

so I reached this step :  Download a BBM v6.1 enabled simulator (9900)
After this in step 7 : 6) Apps using the BlackBerry Messenger Social Platform are only supported by v6.1 of the BlackBerry Messenger app. Download BlackBerry Messenger v6.1.
But I can not download the BBm v6.1 the link keeps on taking me to app world and then to my bb account ...They said to download and install the bbm v6.1 on the simulator.

I got lost here... cause the (BBM v6.1 enabled simulator (9900)) already has in it the bbm v6.1  pre-installed.

Now the application I am using only tries to connect to he bbm and tries to send a msg to a contact.
However I am always stuck at "Step 2 in the simulator" which is Verification step..

Any Ideas ?

Here is the code:
 ---------------------------

package mypackage;

import net.rim.blackberry.api.bbm.platform.BBMPlatformApplication;
import net.rim.blackberry.api.bbm.platform.BBMPlatformContext;
import net.rim.blackberry.api.bbm.platform.BBMPlatformContextListener;
import net.rim.blackberry.api.bbm.platform.BBMPlatformManager;
import net.rim.device.api.command.Command;
import net.rim.device.api.command.CommandHandler;
import net.rim.device.api.command.ReadOnlyCommandMetadata;
import net.rim.device.api.synchronization.UIDGenerator;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.FieldChangeListener;
import net.rim.device.api.ui.Screen;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.ButtonField;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.container.MainScreen;

public class MyBBMPlatformApp extends UiApplication {
private MyBBMAppPlugin myPlugin;
ButtonField _b;
private final String UUID = "5377a180-99cd-11e1-a8b0-0800200c9a66";
BBMPlatformContext platformContext;
public MyBBMPlatformApp() {
myPlugin = new MyBBMAppPlugin();
pushScreen(new MyBBMPlatformScreen());
invokeLater(new Runnable() {
public void run() {
platformContext = BBMPlatformManager
.register(myPlugin);
MyBBMPlatformContextListener platformContextListener;
platformContextListener = new MyBBMPlatformContextListener();
platformContext.setListener(platformContextListener);
}
});
}

private class MyBBMPlatformScreen extends MainScreen {
MyBBMPlatformScreen() {
setTitle("BBM Platform application");
_b = new ButtonField("contacts");
_b.setCommand(new Command(new CommandHandler() {

public void execute(ReadOnlyCommandMetadata metadata,
Object context) {
// TODO Auto-generated method stub
switchScreen(new MyScreen(platformContext));
}

}));
add(_b);
}
}

private class MyBBMAppPlugin extends BBMPlatformApplication {

public MyBBMAppPlugin() {
super("5377a180-99cd-11e1-a8b0-0800200c9a66");
}
}

private class MyBBMPlatformContextListener extends
BBMPlatformContextListener {
public void accessChanged(boolean isAccessAllowed, int accessErrorCode) {
if (!isAccessAllowed) {
// You cannot access the BBM platform
}
}

public void appInvoked(int reason, Object param) {
// Code for handling different contexts for invocation
}
}

public static void main(String[] args) {
MyBBMPlatformApp theApp = new MyBBMPlatformApp();
theApp.enterEventDispatcher();
}

public void switchScreen(final Screen nextScreen) {
final UiApplication ui = UiApplication.getUiApplication();
final Screen currentScreen = ui.getActiveScreen();

if (UiApplication.isEventDispatchThread()) {
ui.popScreen(currentScreen);
ui.pushScreen(nextScreen);
} else {
ui.invokeLater(new Runnable() {
public void run() {
ui.popScreen(currentScreen);
ui.pushScreen(nextScreen);
}
});
}
}
}

-------------------------

package mypackage;

import net.rim.blackberry.api.bbm.platform.BBMPlatformContext;
import net.rim.blackberry.api.bbm.platform.BBMPlatformException;
import net.rim.blackberry.api.bbm.platform.io.BBMPlatformChannel;
import net.rim.blackberry.api.bbm.platform.io.BBMPlatformChannelListener;
import net.rim.blackberry.api.bbm.platform.io.BBMPlatformConnection;
import net.rim.blackberry.api.bbm.platform.io.BBMPlatformData;
import net.rim.blackberry.api.bbm.platform.profile.BBMPlatformContact;
import net.rim.blackberry.api.bbm.platform.profile.BBMPlatformContactList;
import net.rim.blackberry.api.bbm.platform.service.MessagingService;
import net.rim.device.api.ui.container.MainScreen;

/**
* A class extending the MainScreen class, which provides default standard
* behavior for BlackBerry GUI applications.
*/
public final class MyScreen extends MainScreen
{ BBMPlatformChannel _channel;
public MyScreen(BBMPlatformContext platformContext)
{
MessagingService messagingService = platformContext.getMessagingService();
_channel = messagingService.createChannel(_channelListener);
_channel.sendInvitation("Blagnac App bbm testing", "Blagnac", 0);

}

private void onContactLeft(BBMPlatformContact contact)
{
String goodbyeMsg = contact.getDisplayName() + " has left the game.";
BBMPlatformData data = new BBMPlatformData(goodbyeMsg);

try
{
_channel.sendData(data, _channel.getContactList());
}
catch (BBMPlatformException e)
{
// Error handler code
}
}

private BBMPlatformChannelListener _channelListener = new BBMPlatformChannelListener()
{
public void contactsInvited(BBMPlatformConnection conn, BBMPlatformContactList contactList )
{
}

public void contactsJoined(BBMPlatformConnection conn, BBMPlatformContactList contacts, String cookie,
int type)
{
}

public void contactDeclined(BBMPlatformConnection conn, BBMPlatformContact contact)
{
}

public void contactLeft(BBMPlatformConnection conn, BBMPlatformContact contact)
{
onContactLeft(contact);
}

public void dataReceived(BBMPlatformConnection conn, BBMPlatformContact sender, BBMPlatformData data)
{
}

};
}
----------------------------------

Thanks in advance 

 

 

Developer
Posts: 19,612
Registered: ‎07-14-2008
My Device: Not Specified

Re: integrating BBM in my app ???

Use the Simulators you will find here:

http://us.blackberry.com/developers/blackberrymessenger/