Sending an SMS


Last Updated:

  1. smolloy

    smolloy New Member This Topic's Starter

    Joined:
    Nov 16, 2010
    Messages:
    1
    Likes Received:
    0
    Hi all,
    This is my first post here, and my first attempt to write something more complex than HelloWorld!

    I'm writing a little app, and I need to send an SMS when a button is clicked. To do that I am using the following code.

    Code (Text):
    1.     private OnClickListener clickListener = new OnClickListener() {
    2.  
    3.         public void onClick(View v) {
    4.             String dest = deststr.getText().toString();
    5.             String msgconts = msgstr.getText().toString();
    6.            
    7.             SmsManager sm = SmsManager.getDefault();
    8.             sm.sendTextMessage(dest, null, msgconts, null, null);
    9.         }
    10.     };
    11.  
    When I install this app on my testing phone (an HTC Desire), it appears to run correctly (i.e. it doesn't crash), and it has the right permissions, but the SMS doesn't arrive on the phone I sent it to.

    Can anyone let me know what I've done wrong?

    Thanks!
     

    Advertisement

Share This Page

Loading...