Codevoorbeeld: uw toepassing registreren bij het BlackBerry Messenger-platform

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.ui.UiApplication;
import net.rim.device.api.ui.container.MainScreen;
public class MyBBMPlatformApp extends UiApplication
{   
    private MyBBMAppPlugin myPlugin;
       public MyBBMPlatformApp()
         {
           myPlugin = new MyBBMAppPlugin();
           pushScreen(new MyBBMPlatformScreen());
           invokeLater(new Runnable()
            {
              public void run()
                {
                  BBMPlatformContext platformContext = 
                   BBMPlatformManager.register(myPlugin);
                  MyBBMPlatformContextListener platformContextListener;
                  platformContextListener = new MyBBMPlatformContextListener();
                  platformContext.setListener(platformContextListener);
                }
            }	
          );
}
    private class MyBBMPlatformScreen extends MainScreen
    {
        MyBBMPlatformScreen()
        {
            setTitle("BBM Platform application");
        }
    }
    private class MyBBMAppPlugin extends BBMPlatformApplication
    {
        public MyBBMAppPlugin()
        {
            super( "Insert your UUID here" );
        }
    }
    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();
    }
}

Was deze informatie nuttig? Stuur ons uw opmerkingen.