Invoke SMS

Hello

I'm looking for a way to invoke the standard mechanism of SMS in QML.  I searched and found many examples here of sending and receiving SMS, but it uses its own code.  I want to do is spend the number and the message in the real SMS system phones...

Similar to the way I do a phone with this QML code call.

Also, while on the subject...  Is there a way to do the same thing with email.

                function makePhoneCall( arg1 ) {
                    phone.requestDialpad( arg1.NUMBER );
                }

Thank you

I found the solution to this so will share for those who need answers also.

OK first of all in my WebView I get a message from javascript with a string in json format single containing the number and the message.

{'NUMBER': '0123456789', 'TEXT': 'it is a message'}

in my javascript to convert my string json into a field of data encoded in PPS here as described

http://developer.BlackBerry.com/Cascades/documentation/device_platform/invocation/text_messages.html

I then called my C++ function to invoke the sms client

PS.  the code is messy, as I've not cleaned.  going to make PPS coding a separate function.

JavaScript :

                function sendSms( arg1 ) {
                    var obj = {"to":[arg1.NUMBER], "body":arg1.TEXT, "send":"false"};
                    var output = '', name, value;
                    for (name in obj) {
                        output += name + ':';
                        value = obj[name];
                        if (typeof value === 'string') {
                            output += ':' + value;
                        } else if (typeof value === 'number') {
                            output += 'n:' + value;
                        } else if (typeof value === 'boolean') {
                            output += 'b:' + value;
                        } else if (typeof value === 'object') {
                            output += 'json:' + JSON.stringify(value);
                        }
                        output += '\n';
                    }
                    _omnisWrapper.InvokeSms( output );
                }

C++

void BBOmnisWrapper::InvokeSms( QString data )
{
    InvokeManager *invokeManager = new InvokeManager(this);
    InvokeRequest request;
    request.setTarget("sys.pim.text_messaging.composer");
    request.setAction("bb.action.COMPOSE" );
    request.setMimeType("application/text_messaging");
    request.setData(data.toAscii());
    InvokeTargetReply *reply = invokeManager->invoke(request);
}

Tags: BlackBerry Developers

Similar Questions

  • Citing the native SMS

    Hi all

    I developed a small application in blackberry jde 4.7. I invoke the native client SMS and I want my application to die after that I have to call the sms client. But when I click on send, the message is sent successfully and it takes me to the Inbox.

    But after the if I hit the ESC key, nothing happens and crashes just the sms application.

    I tried to hit the end button, and I struck my request once again. But in the debugger, I get the message that my application is already running.

    I tried a work around and implemented outboundmessagelistener to close the application when the Send button send is reached.

    But the problem is sometimes the listener is added successfully and sometimes not. I tried various autour works and even tried through a midlet (but which causes a problem different http://supportforums.blackberry.com/t5/Java-Development/Invoking-SMS-in-a-midlet/m-p/508823#M103011 ).

    Is anyone have a work around? Thanks in advance.

    Hello

    I discovered a way to solve the problem. In the documentation, they gave as it will lift

    the 'operation error cannot perform a client connection' if its open as a client connection. For example: the number. So I changed the way I gave below (and this becomes a connection to the server and no error )

    MC MessageConnection = (MessageConnection)Connector.open("sms://:0");

    But I wonder why this code did not produce any error in other d but 4.5. I also see something weird to 8300.

    Thanks jCarty for helping me

  • Call SMS composer

    Hello

    I had a problem when I invoke the SMS composer with pre-filled values.

    My code:

    function ppsEncode (obj) {}
    data var = ", name, value;
    for (name in obj) {}
    name of data += + ':';
    value = obj [name];
    If (typeof value = "string") {}
    data += ':' + value;
    }
    Else if (typeof value = 'number') {}
    data += "n:" + value;
    }
    Else if (typeof value = "boolean") {}
    data += "b:" + value;
    }
    Else if (typeof value = 'object') {}
    data += ' json:' + JSON.stringify (value);
    }
    data += '\n ';
    }
    return data;
    }

    function invoke() {}
    try {}
    BlackBerry.Invoke.Invoke ({}
    target: "sys.pim.text_messaging.composer."
    Action: "bb.action.COMPOSE."
    type: "application/text_messaging,"
    data : ppsEncode ({"a": "1234", "body": "text", "Send": "false"})
    },
    {function (successEvt)}
    Alert (successEvt);
    },
    {function (errorEvt)}
    Alert (errorEvt);
    }
    );
    }
    {} catch (e)
    Alert (e);
    }
    }

    The problem occurs when I try to run invoke(): Invoke plugin throws 'INVOKE_NO_TARGET_ERROR '.

    How to properly call SMS using WebWorks composer?

    Thank you

    Hello

    Since it is a web application, I would recommend citing text messages using the sms: / / window.

    Here is an example:

    Click here for the msg...

  • 10.2.1 SMS?

    Anyone having any suspicion about SMS support for BB10.2 + .x?

    We can invoke the SMS application at least and read incoming SMS?

    Hello

    You can call the card SMS of your application and pre fill with data, but you can read incoming SMS messages.

    See you soon,.

    Matt

  • How to launch the sms application?

    Hi everyone, I'm moving my app for sms and mms native app I use the following code:

    Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES, new MessageArguments());
    

    but he throws the messages app... is it possible to launch the sms app?

    Thanks for any help!

    Have you checked these arguments?

    http://www.BlackBerry.com/developers/docs/5.0.0api/NET/RIM/BlackBerry/API/invoke/MessageArguments.ht...

  • How to call texting app for composing the sms of the CPP

    Hello

    I am trying to invoke the SMS app to send a msg predefined number.the predefined contact problem is how to define the documentation data.in they mention on pps-encoding. I have no idea on pps-encoding and to set the data.

    so, please help me solve this problem.

    thanking you.

    Thanks for the reply.

    I found another way.

    .

    request.setUri ("sms:"1234567890"?) body = Hai how are you");

    This makes my job

    It sets the number to 1234567890

    and the body of msg for 'hai how are you. "

  • Send SMS listner

    Hello

    I want to add look for admission to the status of out going sms from my mobile

    I want to launch the native app sms and listen to the text message, update sent status, pending, or failed.

    I want also to listne ofr incoming messages and I want to filter these messages based on some critirea as sms body contains this text.

    I used the file listener but could not add on SMS Inbox & Outbox?

    How can I achieve this?

    Can someone help here?

    I suggest that implement you and register for the OutboundMessageLIstener, then perform the invoke. You will be informed when the SMS is sent.

  • Insert text in the SMS message

    I am trying to create an SMS via the click of a button in my application.  For the life of me I can't figure out how to insert predefined text.  I read in some articles without success...

    public void sms(){     MessageArguments sms = new MessageArguments(MessageArguments.ARG_NEW_SMS);        Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES, sms);
    

    the predefined text would come from "text: «+ messageField.getText ()»»

    Any help will be appreciated.  Thank you

    MessageConnection mc = (MessageConnection)Connector.open( "sms://" );
    TextMessage m = (TextMessage)mc.newMessage( MessageConnection.TEXT_MESSAGE );
    m.setAddress( "sms://5558888" );
    m.setPayloadText( "An SMS Message for you" );
    
    Invoke.invokeApplication( Invoke.APP_TYPE_MESSAGES, new MessageArguments( m ) );
    
  • Can someone help me please to find the number of sms sent from blackberry smartphones?

    Hi all

    I'm new to the blackberry smartphone application development. My requirement is to manage the sms sent from a blackberry smartphone like finding the number of SMS messages sent, the destination not like that. I tried running messagelistener, sendlistener and outboundmessagelistener, but something did not work well. So can someone please help me to solve my problem?

    FYI: 1. I've implemented outboundmessagelistener but couldn't find a way to add this port for listening to my request.

    2. I set up sendlistener and added to my application of the method SMS.addSendListener which does not also carry out my requriement.

    So, please help me if you have an idea in these aspects.

    Thank you

    Sanath

    FOR INFO:

    Import net.rim.blackberry.api.sms.OutboundMessageListener;

    SerializableAttribute public class MainClass extends UiApplication implements OutboundMessageListener

    {

    Public Shared Sub main (String [] args)

    {

    PAP MainClass = new MainClass();

    To make the application enter the thread of events and start treatment

    messages,

    We invoke the enterEventDispatcher() method.

    theApp.enterEventDispatcher () ;}

    public void notifyOutgoingMessage (message Message)

    {

    If (this instanceof text message)

    {

    Here you can not manually counting the SMS

    }

    }

  • SMS to predefined number

    Hey,.

    If I use the net.rim.blackberry.api.invoke class to call the messages application, I want to call the SMS Application to create a text to a preset number.

    I found this here:

    MessageArguments(TextMessage textMessage)
    

    But do not know how to use the text Interface. Can someone give me an example for that?

    Thank you!

    Javec, here is an example of how to use it:

    private void composeSms(String address)
    {
        try
        {
            MessageConnection mc = (MessageConnection)Connector.open("sms://");
            TextMessage textMessage = (TextMessage)mc.newMessage(MessageConnection.TEXT_MESSAGE);
            textMessage.setAddress("sms://" + address);
            Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES, new MessageArguments(textMessage));
        }
        catch (IOException e)
        {
            Dialog.alert(e.getMessage());
        }
    }
    
  • Deleting SMS interception?

    I've implemented MessageListener interface in order to intercept incoming SMS.

    I am successfully able to intercept the incoming message, but I want to delete the SMS (should not appear in the Inbox of SMS). Can anyone suggest me the way to do it... ? Here is my code snippet in order to intercept the message

     
    
     
    public class SMSListener implements MessageListener
    {
        private int port;
        private MessageConnection messageConnection;
    
        // constructor
    
        public SMSListener(WebServiceScheduler webServiceScheduler, int port)
        {
            try
            {
                this.messageConnection = (MessageConnection) Connector.open("sms://:" + port);
                this.messageConnection.setMessageListener(this);
            }
            catch (Exception e)
            {
                Logger.getInstance().logInfo(Constants.SMS_LOG_FILE,"SMSListener:Error creating connection to default SMS Port::" + e.getMessage());
            }
        }   
    
        // This method is invoked when a message is received
    
        public void notifyIncomingMessage(MessageConnection messageConnection)
        {
            Logger.getInstance().logInfo(Constants.SMS_LOG_FILE,"notifyIncomingMessage:SMS received");
    
            new Thread()
            {
                MessageConnection conn;
                Thread set(MessageConnection conn)
                {
                    this.conn = conn;
                    return (this);
                }
                public void run()
                {
                    try
                    {
                        Message m = conn.receive();
                        String msg = null;
    
                        if ( m instanceof TextMessage)
                        {
                            TextMessage tm = (TextMessage) m;
                            msg = tm.getPayloadText();
    
                        }
    
                        Logger.getInstance().logInfo(Constants.SMS_LOG_FILE,"notifyIncomingMessage:Message::" + msg);
                        if(parseMessage(msg))
                        {
                            // Do Something and then Delete it
                        }
                    }
                    catch (Exception e)
                    {
                        Logger.getInstance().logInfo(Constants.SMS_LOG_FILE,"notifyIncomingMessage:Error receiving SMS::" + e.getMessage());
                    }
                }
            }.set(messageConnection).start();
        }   
    

    Thanks in advance.

    The short answer is that you can not delete a SMS in the Inbox.  You can send an SMS message that bypasses the Inbox by sending the message on a port not defined by default.  Support for this varies depending on the carrier and the SMS provider.  You can find more information in the knowledge base article: How to use SMS to alert an Application

  • Open SMS and email

    Hello, in my code, I have a menu meaning sms. If he clicks on it, I want to open the page of sent sms... so that it sends the message to all those he wants.

    I also want to send email menu, how I opened its default e-mail? How can I open email page and send him?

    Thanks for help

    You must use the correct arguments, null will not cover it.

    for example
    http://www.BlackBerry.com/developers/docs/7.1.0api/NET/RIM/BlackBerry/API/invoke/MessageArguments.ht...

  • A 'to' extra in the SMS Application

    Hello

    by using the following code, my application to call the SMS Application. Everything works fine except that there is 1 extra "to: Is it possible that I can remove the extra "to"?

    try {
        MessageConnection mc = (MessageConnection)Connector.open("sms://");
        TextMessage textMessage = (TextMessage) mc.newMessage(MessageConnection.TEXT_MESSAGE);
        textMessage.setAddress(smsAddress);
        textMessage.setPayloadText(smsText);
        Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES, new   MessageArguments(textMessage));
    }
    catch(Throwable e) {
        Dialog.alert(e.getMessage());
    }
    

    Thank you.

    It's the default behavior of the message application, if you enter an address yourself, it will be the same.

    you will not be able to change it.

  • BB10 WebWorks: how to call SMS app with content filled beforehand and without a phone number?

    Say that I want to share content via SMS, App can prepare the content, launch the SMS application and users enter the number of the recipient.

    Is this possible? BB10 WebWorks call APIs seems to require pre-filling the destination number.

    https://developer.BlackBerry.com/HTML5/documentation/text_messages.html

    Thank you

    I found another way, instead of directly calling the SMS app, I can call target selector API actions and from there I select SMS or Email or BBM or Facebook or Twitter, LinkedIn, line break work well, a single API call solves all registered social work services.

    https://developer.BlackBerry.com/HTML5/APIs/BlackBerry.Invoke.card.html#.invokeTargetPicker

    try {}
    application of var = {}
    Action: "bb.action.SHARE."
    data : 'Line 1' + '\n ' +.
    'Line 2' + '\n ' +.
    'Line 3' + '\n ';
    MIME: "text/plain",
    target_type: ['MAP']
    };

    () blackberry.invoke.card.invokeTargetPicker
    asks,
    "Share."
    function (successEvt) {},
    {function (errorEvt)}
    );
    }
    {} catch (e)
    }

  • Cannot send SMS on Verizon device

    Quote from the old forum:

    Comments
    Cannot send SMS on Verizon device
    Posted the: March 7, 2007 20:11
     
    The following code snippet to send a text SMS using WMA works very well on a T-Mobile (e.g., 8700 g) and a Cingular device (e.g. 8700 c):

    Con MessageConnection = MessageConnection) Connector.open (address);

    TextMessage msg = (TextMessage) con.newMessage (MessageConnection.TEX T_MESSAGE);

    msg.setAddress (address);
    msg.setPayloadText (content);
    con. Send (MSG); throws IOException on Verizon devices

    However, the same code does not work on Verizon devices (e.g., 8703e and 7130e). The line: con.send (msg) throws an IOException exception. I tried to use different formats for "address" (e.g. "1234567", "+ 1234567", "8001234567", "+ 8001234567", '18001234567', ' + 18001234567 ", etc." "") but they all failed.

    Does anyone know if sending messages SMS using WMA is supported on devices from Verizon?

    Comments: Gerard
    Re: Unable to send SMS on Verizon device
    Posted the: July 10, 2007 11:23
     
    I am also having this problem. It seems that its associated port.

    Any input would be appreciated.

    Comments: comments
    Re: Unable to send SMS on Verizon device
    Posted the: August 10, 2007 14:55
     
    I am also having the same problem on a BB 8830 peripheral and a Verizon of older model device. Is this a problem with all Verizon or specific devices for CDMA based ripe?

    jclarke

    Messages: 1
    Join date: Jan 2008

    Re: Unable to send SMS on Verizon device
    Posted the: 8 January 2008 13:45
     
    I'm having the same problem on Verizon BB 8830. SMS fails with IOException null, however, http works very well.

    Sending sms: / / + 15555551212 {not the real number}

    Phone call log:

    S Java Exception - IOException
    E net.rim.sms - lat-0x8000001f
    d net.rim.sms - TXsb
    I have net.rim.sms - TXst


    a system - MMTpecPhone (3404) not
    a net.rim.sms - inch
    a system - MMTpecPhone (3404) not

    Any suggestions? All these are cryptic log messages are defined?

    Guest: Joe
    Re: Unable to send SMS on Verizon device
    Posted the: February 6, 2008 19:52
     
    I also note the same problem on a Sprint BlackBerry Pearl and 8830. Namely, impossible to send SMS messages and we get an IOException with null message when it fails. Exactly the same code works fine on blackberry mobile PHONE.

    Is there a solution to this problem?

    I think the quality of RIM devices on CDMA technology is of bad quality. RIM rushes these devices at the door. In addition to not being able to send SMS, Sprint devices also seem to inexplicably lose network and requires a MASTER WIPE to restore network connectivity. None of these problems occur on the bays of GSM.

    Jeyaprakash.c

    Messages: 49
    From: chennai, India
    Join date: Oct 2007

    Re: Unable to send SMS on Verizon device
    Posted the: March 21, 2008 01:45
     
    I also had this problem. the labour code will not send sms on cdma phones sprint and a few other oprators protects sms that api third party tat cdma phones requires a certificate level RIM and the operator...

    fpotter

    Messages: 28
    From: Mountain View, CA
    Join date: Feb, 2008

    Re: Unable to send SMS on Verizon device
    Posted the: April 23, 2008 04:53
     
    Someone could rim please chime in here and confirm whether or not sending SMS CDMA phones should work? I burned just 3 hours playing with different things and play with smsdemo.

    If this is a bug, it would be nice to have confirmation that we can all stop wasting our time.

    If it's something that requires the operator level signature, it would be nice to know, too.

    saziz

    Messages: 181


    Join date: Mar 2007

    Re: Unable to send SMS on Verizon device
    Posted the: April 23, 2008 11:14
     
    By program, sending messages on mobile CDMA is currently not supported. As a possible workaround, you can use the API call to send SMS messages via the Messaging Application:

    net.rim.blackberry.api.invoke.Invoke
    http://tinyurl.com/6yecb4

    SARIM
    BlackBerry developer journal
    www.blackberrydeveloperjournal.com

    Comments: Matthew Wheaton
    Re: Unable to send SMS on Verizon device
    Posted the: July 21, 2008 01:12
     
    True... but this just opened the app with pre-filled information. How to send without user intervention?

    This is possible by using the EventInjector and the trackball/wheel orders to send the message using the menu of the injection.

    Here is an example of code that seems to work on Sprint and Verizon devices:

            DatagramConnection connection = null;
            try {
    
                byte[] bytes = messageAsString.getBytes();
                connection = (DatagramConnection) Connector.open( url );
    
                Datagram datagram = connection.newDatagram( bytes, bytes.length );
    
                connection.send( datagram );
            }
            catch (Throwable t) {
                log.error( "Unable to send SMS to " + entry.getRecipient() + " with the url " + entry.getHttpRequest().getUrl() + ".  Message: " + t.getMessage(), t );
                throw t;
            }
            finally {
                IOUtility.safeClose( connection );
            }
    

Maybe you are looking for

  • Update, Z600 CPU

    I have the following HP Z600 and I want to upgrade to the current Intel Xeon E5520 processor to E5650, E5660 or X 5675 processors. The two basic questions I have are: Is this possible?If so, what exactly should I do? Implicit in these two questions a

  • WMP11 stop playing about streaming movies a minute

    Hello My friend and I have a problem with WMP11 (Windows Media Player11). WMP stops playing streaming movies a minute with the use of the UC fall almost to ZERO. But he continues to receive data streaming, bandwidth which is 1 MB/s. I have confirmed

  • I have Windows XP and my PC gets slower and slower

    I have Windows XP and my PC gets slower and slower

  • Separate devices

    Hello world.  I have an EA3500.  The problem I have is when my iPad 2 to connect to the network in the list of devices, he demonstrated a device name with the ip address 2.  How can I separate the 2 iPads in 2 separate devices?  I just need to set up

  • failure to reactivate Windows 7 Home Basic 32 bit

    A few days ago I activate Ms win 7 Home Basic 32-bit (oem System Builder pack) on dell vostro desktop.now the card mother burned sytems and I change a new msi do motherboard, then I try to reinsntall win7 and activate but I can't activate the product