0

I have this code for sending sms to cellphones . However it doesn't seem to deliver the sms, am i missing something ? should i buy some account from cellular companies ?

public void sending (View v) 
{
    String messageToSend = "this is a message";
    String number = "1234567890";
    try {
        SmsManager smsManager = SmsManager.getDefault();
        smsManager.sendTextMessage(number, null, messageToSend, null, null);
        Toast.makeText(getApplicationContext(), "SMS Sent!",
                Toast.LENGTH_SHORT).show();
    } catch (Exception e) {
        Toast.makeText(getApplicationContext(),
                "SMS faild, please try again later!", Toast.LENGTH_LONG)
                .show();
        e.printStackTrace();
    }
}

I have tried to send sms to my number many times,i used my number as "1234567890" using it as i dial it every day, then i tried using it with the international code "+9721234567890"

thanks in advance

Jasser
  • 65
  • 1
  • 9

0 Answers0