Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Regular Contributor
mohdfarhanakram
Posts: 73
Registered: ‎12-30-2011
My Device: All devices

Launch Native SMS screen with specific text message

Hi Every one,

 

   I want to launch native SMS screen with specific text message and without any phone number , i have written below code it is working fine with 6.0 & 7.0 OS but it is not working OS 5.0 i dont know why please help me

  public static void invokeNewSMS(String body) {
                try {
                        MessageConnection con = (MessageConnection) Connector.open("sms://");
                       
                        TextMessage message = (TextMessage) con.newMessage(MessageConnection.TEXT_MESSAGE);
                        

                       
                        message.setPayloadText(body);
                        MessageArguments msgArgs = new MessageArguments(message);
                        Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES, msgArgs);
                } catch (Exception e) {
                    System.out.println("Error : "+ e.getMessage());
                }
        }       

 

Thanks

Mohd Farhan
Please use plain text.