Retrieving version information about your application and the BlackBerry Messenger SDK

The net.rim.blackberry.api.bbm.platform.profile.UserProfile class provides methods that allow your application to query the version of your application and the version of the BlackBerry Messenger SDK that is installed on a user's BlackBerry device. You can also query net.rim.blackberry.api.bbm.platform.profile.BBMPlatformContact to obtain the same information about the user's contacts. You can use this information to determine whether your application is compatible between users.

To retrieve the version of your application that is installed on a user's BlackBerry device, invoke getAppVersion() on the userProfile object that represents the user's BBM profile.

String myTpaVersion = myUserProfile.getAppVersion();

To retrieve the version of your application that is installed by a user's contact, invoke getAppVersion() on a BBMPlatformContact object that represents the contact's BBM profile.

String tpaVersion = contact.getAppVersion();

// Use the application version information to determine the compatibility
// of your application between users. 

If (myTpaVersion > tpaVersion)
{
     Dialog.alert("Unable to start game. Contact requires a newer version
      of the application.");
)

To retrieve the version of the BlackBerry Messenger SDK that is installed on a user's BlackBerry device, invoke getBBMSDKVersion() on the userProfile object that represents the user's BBM profile.

int myBbmSdkVersion = userProfile.getBBMSDKVersion();

To retrieve the version of the BlackBerry Messenger SDK that is installed by a user's contact, invoke getBBMSDKVersion() on a BBMPlatformContact object that represents the contact's BBM profile.

int bbmSdkVersion = contact.getBBMSDKVersion();

// Use the SDK version information to determine BBM platform compatibility
// between BlackBerry devices
    
if (myBbmSdkVersion > bbmSdkVersion)
{
    Dialog.alert ("Unable to share content. Contact requires a newer
     version of the BlackBerry Messenger SDK");
}

Was this information helpful? Send us your comments.