Error when trying to send a text Message from my app


Another option is to simply create your own implementation of text and use it instead to open an essentially useless connection just to get an instance of text.  The interface of text is very small and simple, very easy to implement yourself.

public class MyTextMessage implements TextMessage {

    private final Date _timestamp;    private String _payloadText;    private String _address;

    public MyTextMessage() {        this._timestamp = new Date();    }

    public String getAddress() {        return this._address;    }

    public String getPayloadText() {        return this._payloadText;    }

    public Date getTimestamp() {        return this._timestamp;    }

    public void setAddress(String address) {        this._address = address;    }

    public void setPayloadText(String payloadText) {        this._payloadText = payloadText;    }

}

Then, to start the application of message for the user do something like this:

TextMessage textMessage = new MyTextMessage();
textMessage.setPayloadText("Hey, this is the message body");
textMessage.setAddress("sms://+15556667777");
MessageArguments args = new MessageArguments(textMessage);
Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES, args);

Tags: BlackBerry Developers

Similar Questions

Maybe you are looking for