SMS

Provides static functions to send SMS messages

Supported Platform(s)

- BlackBerry OS 5.0+
- Ripple Emulator

View Supported Platform Table

APIOS 5.0OS 6.0OS 7.0PlayBookRipple
addReceiveListener Y Y Y  Y
removeReceiveListener Y Y Y  Y
send Y Y Y  Y
isListeningForMessage Y 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 IDOS 5.0OS 6.0OS 7.0PlayBookRipple
<feature id="blackberry.message.sms" /> Y Y Y  Y

Permission Elements (PlayBook Only)
This API does not require a <permission> element to be declared in the configuration document of your BlackBerry WebWorks Application.

addReceiveListener


static Undefined addReceiveListener(callback : function(String|String|Date))

Supported Platform(s)

 - BlackBerry OS 5.0+
 - Ripple Emulator

Description

SMS listener to receive a message when it arrives



Parameter Type Description
callback function(String | String | Date) Callback function that is invoked when a new SMS message is received. Overwrites the previous callback. The parameters are: message, sender, and date.

removeReceiveListener


static Boolean removeReceiveListener()

Supported Platform(s)

 - BlackBerry OS 5.0+
 - Ripple Emulator

Description

Remove the registered listener. Return false if there is no listener


send


static Undefined send(message : String, address : String)

Supported Platform(s)

 - BlackBerry OS 5.0+
 - Ripple Emulator

Description

Static function to send out an SMS message



Parameter Type Description
message String The text that should be sent
address String Address where the message should be delivered to.

Properties:


Property Type Description Supported Platform(s)
isListeningForMessage Static
Boolean
determine whether the message listeners are activated
 - BlackBerry OS 5.0+
 - Ripple Emulator

Code Example(s)


<script type="text/javascript">
  blackberry.message.sms.send("hello world", "987654321");

  var listener = function (msg, from, date) {
    alert(from+" "+msg+" "+date);
  }

  blackberry.message.sms.isListeningForMessage = true;
  blackberry.message.sms.addReceiveListener(listener);

  if (blackberry.message.sms.removeReceiveListener()){
    alert("Listener removed successfully.");
    blackberry.message.sms.isListeningForMessage = false;
  }
</script>

Documentation generated by JsDoc Toolkit 2.4.0 on Sun Dec 30 2012 13:31:20 GMT-0500 (EST)