1. Introducing Channels - a new way to chat with other Android users!
    Dismiss Notice

Cannot send SMS


Last Updated:

  1. jl2035

    jl2035 New Member This Topic's Starter

    Joined:
    Jun 12, 2009
    Messages:
    2
    Likes Received:
    0
    I'm building an application which will include a functionality to send sms. I really want a very simple way to do this. It doesn't look so difficult but I can't make it work. I found this cool guide: SMS Messaging in Android | mobiForge ...

    ...so I used his 'sendSMS' method:
    Code (Text):
    1.  
    2. private void sendSMS(String message, String phoneNo) {
    3.       PendingIntent pi=PendingIntent.getActivity(this, 0, new Intent(), 0);
    4.       SmsManager sms = SmsManager.getDefault();
    5.       sms.sendTextMessage(phoneNo, null, message, pi, null);
    6.     }  
    7.  
    When I call the function I get the catch exception.
    Code (Text):
    1.  
    2. if (phoneNo.length()>0 && message.length()>0)  
    3.      {
    4.            try
    5.            {
    6.                  sendSMS(message, phoneNo);
    7.            }
    8.             catch(Exception e)
    9.            {
    10.                  EditText et4=(EditText)findViewById(R.id.EditTextGlavno);
    11.                  et.setText("Something went wrong...");
    12.             }
    13.      }        
    14.  
    oh... and guys ... I'm a little bit newby so please be gentle...
     

    Advertisement
  2. jl2035

    jl2035 New Member This Topic's Starter

    Joined:
    Jun 12, 2009
    Messages:
    2
    Likes Received:
    0
    I thought this is a support forum...
     

Share This Page

Loading...