Skip to content Skip to sidebar Skip to footer

Sending Sms Error Generic Failure Again And Agian

Here is my code.. private void sendSMS(String phoneNumber, String message) { String SENT = 'SMS_SENT'; String DELIVERED = 'SMS_DELIVERED'; PendingIntent sentPI = Pendi

Solution 1:

If your message is too long then use handler inside your code

new Handler().postDelayed(new Runnable() {
                publicvoidrun() {

                 SmsManager sms = SmsManager.getDefault();
                 sms.sendTextMessage(phoneNumber, null, message, sentPI, deliveredPI);
                }
            }, 1000*40);

or use this link

Solution 2:

If you are using a Dual Sim Phone, please check if Preferred Sim for SMS, is IS NOT set to "Ask every time".

You need to set a default SIM. if you are using

SmsManager sms = SmsManager.getDefault();

Solution 3:

If your phone is dual sim than first you need to set a preferred sim for sms in your phone setting (google it) and that default sim must be contain some balance amount...the other short trick to set preferred default sim in your phone is-just turn one sim off for some time so another sim will automatically become your preferred default sim for sms :) The phone number parameter in sendTextMessage() can be used in both ways i.e with country code like +919783###### or without code like 9783######. both will work

Solution 4:

Your message might be too long. In that case, you should use divideMessage and sendMultipartTextMessage, like this:

smsManager.sendMultipartTextMessage(phoneNumber, null, divideMessage(message), null, null);

Post a Comment for "Sending Sms Error Generic Failure Again And Agian"