net.rim.blackberry.api.bbm.platform
Class BBMPlatformContextListener

java.lang.Object
  |
  +--net.rim.blackberry.api.bbm.platform.BBMPlatformContextListener

public abstract class BBMPlatformContextListener
extends Object

Receives and handles status change events related to the BBMPlatformContext.

Since:
BBM SDK 1.0

Constructor Summary
BBMPlatformContextListener()
           
 
Method Summary
abstract  void accessChanged(boolean isAccessAllowed, int accessErrorCode)
          Called when the access to BBM for the plugin has changed.
 void appInvoked(int reason, Object param)
          Deprecated. Use {@link appInvoked(int, Object, Presence)
 void appInvoked(int reason, Object param, Presence user)
          Called in certain cases when the application is invoked from within BBM.
 

Constructor Detail

BBMPlatformContextListener

public BBMPlatformContextListener()
Since:
BBM SDK 1.0
Method Detail

accessChanged

public abstract void accessChanged(boolean isAccessAllowed,
                                   int accessErrorCode)
Called when the access to BBM for the plugin has changed. The listener will be invoked on the event thread of the application that set it.
Parameters:
isAccessAllowed - whether access to BBM is allowed
accessErrorCode - the error code that explains why access to BBM is not allowed. Codes are defined in BBMPlatformContext.
Since:
BBM SDK 1.0

appInvoked

public void appInvoked(int reason,
                       Object param)
Deprecated. Use {@link appInvoked(int, Object, Presence)

Called in certain cases when the application is invoked from within BBM. At the moment this method is only invoked via profile box items.

ProfileBoxItem Invocations

The user can launch the application via profile box items (see UserProfileBox). This callback will be invoked with the reason BBMPlatformContext.INVOKE_PROFILE_BOX_ITEM and a UserProfileBoxItem param -- the profile box item which was clicked.
 appInvoked(int reason, Object param) {
     if(reason == BBMPlatformContext.INVOKE_PROFILE_BOX_ITEM) {
         UserProfileBoxItem clickedItem = (UserProfileBoxItem) param;
         // Handle profile box item click...
     }
 }
 
Note: This will only be invoked once platform access is allowed.
Parameters:
reason - How the application was invoked. One of the INVOKE_* constants in BBMPlatformContext.
param - Parameter associated with the invocation.
Since:
BBM SDK 1.0
See Also:
UserProfileBox

appInvoked

public void appInvoked(int reason,
                       Object param,
                       Presence user)
Called in certain cases when the application is invoked from within BBM.

The param and user parameters are dictated by the invocation reason. See the INVOKE_* constants in BBMPlatformContext.

Note: This will only be invoked once platform access is allowed.

Example:

 public void appInvoked(int reason, Object param, Presence user) {
     // User clicked a user's profile box
     if(reason == BBMPlatformContext.INVOKE_PROFILE_BOX) {
         // e.g. Show detail for user's whole TPA profile box
         
     // User clicked a user's profile box item
     } else if(reason == BBMPlatformContext.INVOKE_PROFILE_BOX_ITEM) {
         // e.g. Show the score and trophy represented by a profile box item
         UserProfileBoxItem item = (UserProfileBoxItem) param;
         int score = Integer.parseInt(item.getCookie());
     
     // User clicked a user's personal message TPA link
     } else if(reason == BBMPlatformContext.INVOKE_PERSONAL_MESSAGE) {
         // e.g. Allow the user to comment on the user's personal message in the user's TPA profile
         String personalMessage = (String) param;
     
     // User clicked a contact's chat message TPA link
     } else if(reason == BBMPlatformContext.INVOKE_CHAT_MESSAGE) {
         // e.g. Start an activity with the contact
         
     } 
 }
 
Parameters:
reason - How the application was invoked. See the INVOKE_* constants in BBMPlatformContext.
param - Parameter associated with the invocation. May be null. Dictated by reason.
user - User associated with the invocation. May be null, and may be the current user. Dictated by reason.
Since:
BBM SDK 1.3



Copyright 1999- Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.