1. Are you ready for the Galaxy S20? Here is everything we know so far!

Cannot send SMS

Discussion in 'Android Apps & Games' started by jl2035, Jan 10, 2010.

  1. jl2035

    jl2035 Lurker
    Thread Starter

    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...
     


  2. jl2035

    jl2035 Lurker
    Thread Starter

    I thought this is a support forum...
     
Loading...
Similar Threads - Cannot send SMS
  1. izabelle221
    Replies:
    2
    Views:
    135
  2. Doulos Adonai
    Replies:
    4
    Views:
    314
  3. droidros
    Replies:
    5
    Views:
    310
  4. Samir Essa
    Replies:
    0
    Views:
    352
  5. Froglet89
    Replies:
    2
    Views:
    235
  6. akaskhu
    Replies:
    2
    Views:
    298
  7. Somogyi Henrik
    Replies:
    2
    Views:
    326
  8. ravaturno
    Replies:
    4
    Views:
    1,015
  9. MyUsernameRox
    Replies:
    3
    Views:
    4,162
  10. vertigoelectric
    Replies:
    0
    Views:
    599

Share This Page

Loading...