Current User

Provides access to the current user's information.


Supported Platform(s)

- BlackBerry OS 5.0+
- BlackBerry 10
View Supported Platform Table
APIBB5.0BB6.0BB7.0PB1.0PB2.0BB10Ripple
blackberry.bbm.platform.self.getDisplayPicture           Y 
blackberry.bbm.platform.self.setDisplayPicture Y Y Y       
blackberry.bbm.platform.self.setDisplayPicture           Y 
setPersonalMessage           Y 
setPersonalMessage Y Y Y     Y 
setStatus           Y 
setStatus Y Y Y       

Configuration Document Settings

To use all of the API described for this object, you must ensure the following settings are in your configuration document:

You must declare the feature element(s) below in your configuration document:

Feature IDBB5.0BB6.0BB7.0PB1.0PB2.0BB10Ripple
<feature id="blackberry.bbm.platform" /> Y Y Y     Y 
Permission Elements (PlayBook and BlackBerry 10+)
You must declare the permission element(s) below in your configuration document:
- <rim:permit>bbm_connect</rim:permit>
BBM APIs requre this permission to be set


Functions

static void blackberry.bbm.platform.self.getDisplayPicture (onComplete: function(image : String))


Gets the user's display picture.


Supported Platforms
 - BlackBerry 10


Parameters
onComplete Invoked when the image has been retrieved.

image: Contains a base64 string representation of the image

Code Example:
<script type="text/javascript">
// Get the user's display picture
blackberry.bbm.platform.self.getDisplayPicture(function (image) {
    // do something with the image here
});
</script>

static void blackberry.bbm.platform.self.setDisplayPicture (displayPictureURI : String, onComplete: function(accepted : Boolean))


Sets the user's display picture from a URI. A dialog appears and allows the user to accept or cancel the change.

The URI must be fully qualified. Non-local URIs must be whitelisted in the application's configuration file. Examples:

  • Locally from within the widget package (e.g. "local:///smiley.jpg")
  • From the filesystem of a BB5.0+ device (e.g. "file:///SDCard/BlackBerry/pictures/smiley.jpg")


Supported Platforms
 - BlackBerry OS 5.0+


Parameters
displayPictureURI The fully qualified URI.
onComplete Invoked when the user has dismissed the dialog.

accepted: true if the user accepted the change; false otherwise.

Code Example:
<script type="text/javascript">
// Set the user's display picture
blackberry.bbm.platform.self.setDisplayPicture("local:///smiley.jpg", function (accepted) {
    if(accepted) {
        // User accepted the change
    } else {
        // User canceled the change
    }
});
</script>

static void blackberry.bbm.platform.self.setDisplayPicture (displayPictureURI : String, onSuccess: function(success : Boolean), onError: function(error : String))


Sets the user's display picture from a URI. A dialog appears and allows the user to accept or cancel the change. Note that the display picture cannot exceed 32KB.

The URI must be fully qualified. Non-local URIs must be whitelisted in the application's configuration file. Examples:

  • Locally from within the widget package (e.g. "local:///smiley.jpg")
  • From the filesystem of a BB10 device (e.g. "file:///accounts/1000/shared/photos/smiley.jpg")


Supported Platforms
 - BlackBerry 10


Parameters
displayPictureURI The fully qualified URI.
onSuccess Invoked when the request to change the display picture is shown to the user.

success: true if the image was found.
onError Invoked when there was an error setting the picture.

error: Contains error message.

Code Example:
<script type="text/javascript">
// Set the user's display picture
blackberry.bbm.platform.self.setDisplayPicture("local:///smiley.jpg", function (success) {
    alert("Image found");
}), function (error) {
    alert(error);
});
</script>

Properties

static void setPersonalMessage


Sets the user's personal message. A dialog appears and allows the user to accept or cancel the change.


Supported Platforms
 - BlackBerry 10


Parameters
personalMessage The personal message. The maximum length is 160 characters; anything over will be truncated. If null is provided then the personal message is cleared.

static void setPersonalMessage


Sets the user's personal message. A dialog appears and allows the user to accept or cancel the change.


Supported Platforms
 - BlackBerry OS 5.0+
 - BlackBerry 10


Parameters
personalMessage The personal message. The maximum length is 160 characters; anything over will be truncated. If null is provided then the personal message is cleared.
onComplete Invoked if the user dismissed the dialog.

accepted: true if the user accepted the change; false otherwise.

static void setStatus


Sets the user's status. A dialog appears and allows the user to accept or cancel the change.


Supported Platforms
 - BlackBerry 10


Parameters
status The status: one of "available" or "busy".
message The optional status message. If not provided, the default message of either "Available" or "Busy" will be used.
onComplete Invoked if the user dismissed the dialog.

accepted: true if the user accepted the change; false otherwise.

static void setStatus


Sets the user's status. A dialog appears and allows the user to accept or cancel the change.


Supported Platforms
 - BlackBerry OS 5.0+


Parameters
status The status: one of "available" or "busy".
message The optional status message. If not provided, the default message of either "Available" or "Busy" will be used.
onComplete Invoked if the user dismissed the dialog.

accepted: true if the user accepted the change; false otherwise.

Code Example:
<script type="text/javascript">
// Set the user's status and status message
blackberry.bbm.platform.self.setStatus("busy", "Playing Tic-Tac-Toe!", function (accepted) {
    if(accepted) {
        // User accepted the change
    } else {
        // User canceled the change
    }
});
</script>
Documentation generated by JsDoc Toolkit 2.4.0 on Mon Feb 11 2013 14:51:10 GMT-0500 (EST)