BBM Platform

The BBM Social Platform (BBMSP) provides APIs that allow you to leverage the social features and functionality of BlackBerry Messenger from within your app.

Since: BlackBerry WebWorks 2.0

Installation:

To use this API in your project, add the BBM plugin:

webworks plugin add com.blackberry.bbm.platform

Learning Resources:

Download BBM SDK Resources Download the resources required to use the BBM SDK for WebWorks [BlackBerry].

Getting Started Guide Set up the BBM SDK for BlackBerry WebWorks [BlackBerry Developer Resource Center].

Sample - BBM for BB10 Sample that demonstrates how to use the BlackBerry BBM APIs for BlackBerry 10 [BlackBerry on GitHub].

Tutorial - WebWorks app and BBM

Functions:
void register()
Events:
void onaccesschanged

register()

Registers your app to allow it to access the BBM Social Platform.

The application must assign a callback to blackberry.bbm.platform.onaccesschanged before registering. During registration, a dialog opens and guides the user through the registration process. The application should wait until blackberry.bbm.platform.onaccesschanged is invoked before continuing.

Applications in Test Environment Applications must provide a UUID used to identify the application in the test environment. If the application is in BlackBerry World, the UUID will not be used. The same UUID should be used for future releases of the same application; otherwise communication between them will not be possible. The UUID must be a randomly generated 36-character UUID. Any UUID generator can be used.

Synopsis:

void blackberry.bbm.platform.register(options)

Parameters:

options {Object}

Options.

uuid {String}

ID used to identify the application in the test environment.

Example:

<script type="text/javascript">

    // Create callback invoked when access changes
    document.addEventListener("onaccesschanged", accessChangedCallback);

    function accessChangedCallback(accessible, status) {
        if (status == "unregistered") {
            // App is unregistered, proceed to register
            registerApp();
        } else if (status == "allowed") {
            // Access allowed
        }
        // Listen for other status...
    };

    function registerApp() {
    // Register with the platform
         blackberry.bbm.platform.register({
             uuid: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" // Randomly generated UUID
         });
    }

</script>
            

onaccesschanged

This event is fired by the system. If you want to listen to the event, you can use the document.addEventListener function and remove the listener using the document.removeEventListener function. Registers for access to the BBM Social Platform.

Synopsis:

Event

Parameters:

accessible {Boolean}

Flag if the BBM Social Platform access is allowed.

status {String}

Status message of current BBMSP access.

  • "allowed": Access is allowed.
  • "unregistered": Access is blocked because the application is currently not registered.
  • "pending": Access is pending and being processed.
  • "user": Access is blocked by the user.
  • "rim": Access is blocked by BlackBerry (the application has most likely violated the terms of use).
  • "nodata": Access is blocked because the device is out of data coverage. A data connection is required to register the application.
  • "unexpectederror": Access is blocked because an unexpected error has occurred.
  • "invaliduuid": Access is blocked because an invalid UUID was provided when registering.
  • "temperror": Access is blocked because of a temporary error. The application should try to call {blackberry.bbm.platform.register} in 30 minutes, or the next time the application starts.

Example:

<script type="text/javascript">

    // Create callback invoked when access changes
    document.addEventListener("onaccesschanged", accessChangedCallback);

    function accessChangedCallback(accessible, status) {
        if  (status == "allowed") {
            // Access allowed
        } else if (status == "user") {
            // Access blocked by user
        } else if (status == "rim") {
            // Access blocked by RIM
        }
        // Listen for other status...
        };

</script>
            

Last modified: 2014-09-29



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus