BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 05-01-2012, 03:20 AM   #1 (permalink)
Knows Where the Search Button Is
 
clowicek's Avatar
 
Join Date: May 2007
Location: Czech republic
Model: 9360
PIN: 286E290E
Carrier: T-MOBILE CZ
Posts: 15
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default UserProfile - Blackberry Messenger SDK

Please Login to Remove!

Hello All,
for first time... i`m sorry for my english.
Now to my problem. I programmed an application that uses information from BBM ... The application has a splash screen and when I am start application as it is properly registered in my BBM where it and i see it. Nevertheless, he ends up splash screen so I do not have access to information from BBM. Rather, I am unable to initialize BBMPlatformContext in new screen so that I could use userprofile USERPROFILE = platformContext.getUserProfile (), etc.
probably doing something wrong but I'm not in a state to find out what.

this is code which started if application run (BBM is already registered)
Code:
import net.rim.device.api.system.ControlledAccessException;
import net.rim.device.api.ui.UiApplication;

import com.stepan.kutaj.APP.util.*;
import com.stepan.kutaj.APP.screen.*;
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;

public class APP  extends UiApplication{

	private BBMPlatformContext platformContext = null;
	private MyBBMAppPlugin myPlugin;
	
	public APP() 
	{
		myPlugin = new MyBBMAppPlugin();
		invokeLater(new Runnable()
        {
           public void run()
           {
              try 
              {
					platformContext = BBMPlatformManager.register(myPlugin);
              }
              catch (ControlledAccessException e) 
              {
                 // The BBM platform has been disabled
              }
              if (platformContext != null) 
              {
                 MyBBMPlatformContextListener platformContextListener;
                 platformContextListener = new MyBBMPlatformContextListener();
                 platformContext.setListener(platformContextListener);
                 
              }
              
           }
        }
		);
		
		pushScreen(new SplashScreen(UiApplication.getUiApplication(), new RegistrationScreen()));
	}

	public static void main(String[] args) 
	{
		APP app = new APP();
		app.enterEventDispatcher();
	}
	
	
	private class MyBBMAppPlugin extends BBMPlatformApplication
    {
        public MyBBMAppPlugin()
        {
            super( "UUID" );
        }
    }
	
    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
        }
    }
}
this is next screen where i don`t implement BBMPlatformContext
Code:
import net.rim.blackberry.api.bbm.platform.*;
import net.rim.blackberry.api.bbm.platform.profile.*;
import net.rim.device.api.ui.container.*;
import java.util.*;

public class RegistrationScreen extends MainScreen 
{    
    public RegistrationScreen(BBMPlatformContext platformContext) 
    {
        UserProfile userProfile = platformContext.getUserProfile();
        
        String displayName = userProfile.getDisplayName();
        Bitmap displayPicture = userProfile.getDisplayPicture();
        String personalMsg = userProfile.getPersonalMessage();
        int status = userProfile.getStatus();
        String statusMsg = userProfile.getStatusMessage();
    }
}
i try this and everything application end with error that i cannot access to modul
Code:
import net.rim.device.api.system.ControlledAccessException;
import net.rim.device.api.ui.UiApplication;

import com.stepan.kutaj.APP.util.*;
import com.stepan.kutaj.APP.screen.*;
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;

public class APP  extends UiApplication{

	private BBMPlatformContext platformContext = null;
	private MyBBMAppPlugin myPlugin;
	
	public APP() 
	{
		myPlugin = new MyBBMAppPlugin();
		invokeLater(new Runnable()
        {
           public void run()
           {
              try 
              {
					platformContext = BBMPlatformManager.register(myPlugin);
              }
              catch (ControlledAccessException e) 
              {
                 // The BBM platform has been disabled
              }
              if (platformContext != null) 
              {
                 MyBBMPlatformContextListener platformContextListener;
                 platformContextListener = new MyBBMPlatformContextListener();
                 platformContext.setListener(platformContextListener);
                 
              }
              
           }
        }
		);
		
		pushScreen(new SplashScreen(UiApplication.getUiApplication(), new RegistrationScreen(platformContext))); 
	}

	public static void main(String[] args) 
	{
		APP app = new APP();
		app.enterEventDispatcher();
	}
	
	
	private class MyBBMAppPlugin extends BBMPlatformApplication
    {
        public MyBBMAppPlugin()
        {
            super( "UUID" );
        }
    }
	
    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
        }
    }
}
Thank you for help!!!

Best regards,

Stepan
__________________
Stepan
----------------------------------------------------
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads for: UserProfile - Blackberry Messenger SDK
Thread Thread Starter Forum Replies Last Post
Web Desktop 5 no application loader Walter_Str BES Admin Corner 2 08-27-2009 08:05 AM
New to BES admin , need help with messages. bigwig BES Admin Corner 5 10-17-2007 11:59 AM
BES 4.1 for Exchange - Now Available to TSupport Customers jibi BES Admin Corner 86 03-31-2006 12:06 PM
BES Domino 4.0 SP2 rsun BES Admin Corner 12 08-25-2005 02:27 PM
[2005-05-11] BlackBerry Connection bfrye BlackBerry In the News 0 05-11-2005 10:16 AM





Copyright © 2004-2014 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.