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:
When I call the function I get the catch exception.
oh... and guys ... I'm a little bit newby so please be gentle...
...so I used his 'sendSMS' method:
Code:
private void sendSMS(String message, String phoneNo) {
PendingIntent pi=PendingIntent.getActivity(this, 0, new Intent(), 0);
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phoneNo, null, message, pi, null);
}
Code:
if (phoneNo.length()>0 && message.length()>0)
{
try
{
sendSMS(message, phoneNo);
}
catch(Exception e)
{
EditText et4=(EditText)findViewById(R.id.EditTextGlavno);
et.setText("Something went wrong...");
}
}