5

I'm trying to send an SMS with the android.telephony.SMSManager. When i send a SMS to someone around the country, it works. When i try so send an SMS to California for example, it doesnt work anymore.

Also, When i try to send a SMS to California, it returns a RESULT_ERROR_GENERIC_FAILURE with errorcode 28.

Anyone knows what might be the issue?

Code used:

SmsManager sms = android.telephony.SmsManager.getDefault(); 
sms.sendTextMessage(getResources().getString(R.string.destination_address),    
null, getResources().getString(R.string.forward), sentPI, deliveredPI);

I also added the SEND_SMS permission in the manifest file.

Thanks in advance.

Wouter.

Tim Lewis
  • 27,813
  • 13
  • 73
  • 102
Wouter
  • 73
  • 5

2 Answers2

3

Try appending the country code:

 SmsManager sms = android.telephony.SmsManager.getDefault(); 
 sms.sendTextMessage("001" + getResources().getString(R.string.destination_address), null, getResources().getString(R.string.forward), sentPI, deliveredPI);
Nana Ghartey
  • 7,901
  • 1
  • 24
  • 26
2

Already found the solution ! Looks like i had to add +1 to the Destination phone numer since i want to send a SMS from Europe to US.

Wouter
  • 73
  • 5