Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android SMSManager Generic Failure

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.

like image 492
Wouter Avatar asked Feb 10 '15 14:02

Wouter


2 Answers

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);
like image 173
Nana Ghartey Avatar answered Oct 11 '22 15:10

Nana Ghartey


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.

like image 23
Wouter Avatar answered Oct 11 '22 17:10

Wouter