Send a PIN message to BlackBerry devices

To send a PIN message message to multiple BlackBerry® devices, you can use the multi-object sendMessageToUsers() method. To send a PIN message to one BlackBerry device, you can use the single-object sendMessageToUsers() method.
Before you begin: Retrieve the following variables:
  • messageSubject string for the subject of the message that you want to send
  • messageBody string for the body of the message you want to send
  • userIDs integers for the user account IDs of the user accounts you want to send the message to.
  1. Create the message object.
    UserMessage message=new UserMessage();
    message.subject = messageSubject;
    message.body = messageBody;
  2. Specify the type of message that you want to send. To send a PIN message, use the DispatcherMessageTypeEnumType.PIN enumeration value.
    DispatcherMessageTypeEnum messageType=new DispatcherMessageTypeEnum();
    messageType.@enum = DispatcherMessageTypeEnumType.PIN;
    messageType.enumSpecified = true
  3. Invoke sendMessageToUsers().
    SendMessageToUsers request = new sendMessageToUsers();
    request.userIds = userIDs;
    request.message = message;
  4. Check the result for errors and handle any errors.
    if (result.sendMessageToUsersReturnStatus.code != SendMessageToUserReturnStatusEnumType.SUCCESS) 
        // handle any errors

Was this information helpful? Send us your comments.