KavitaDev
KavitaDev

Reputation: 485

Why do I get "Generic Failure" error while sending SMS?

I am working on android project where I need to send SMS. My app collects required information by consuming a web service and this information is very short and pure text. This information is then sent in the form of SMS.

I have used broadcast receiver that will keep track of whether SMS is sent successfully or not and simply add a log entry. I have used SmsManager to send SMS.

My device is having very good WiFi strength and good GPRS network. While sending SMS, I have found that broadcast receiver inserts log entries, some for "Successful" and some for "Generic Failure".

Why few SMS fail because of "Generic Failure"? What is the reason behind this?

I have googled and found that some people are saying to turn OFF WiFi. But for consuming web service I need WiFi ON.

Can anyone give some insight on this? Is there any solution for this problem?

Upvotes: 3

Views: 59843

Answers (7)

EL TEGANI MOHAMED
EL TEGANI MOHAMED

Reputation: 1898

I had the same problem and I solved it by removing the sim phone from sendTextMessage and made it null

Upvotes: 0

turtleboy
turtleboy

Reputation: 7572

I found that once the data is over 160 chars, i got a generic failure.

Upvotes: 0

Sohaib Rahman
Sohaib Rahman

Reputation: 183

I had the same problem and found out I was out of my credit balance in my mobile.

Upvotes: 0

Yi Jiang
Yi Jiang

Reputation: 4028

I have met similar problem. After couple of minutes, I found the phone number I try to send is invalid.

Thus, any one has this problem, please check the phone number first!

Upvotes: 0

Sunil Kumar
Sunil Kumar

Reputation: 7092

I had already to overcome this generic failure message with the help of time delay to send one device to multiple numbers, It almost remove the generic failure

for(int index=0; index < phone.length; index++){
             phonenumber=phone[index];
            Toast.makeText(cxt, "Phone number is: "+phonenumber, Toast.LENGTH_LONG).show();
            if(index==0){
                Send_SMS(phonenumber.toString().trim(), textmessage);
            }
            else{
                new Handler().postDelayed(new Runnable() {
                    public void run() {

                        Send_SMS(phonenumber.toString().trim(), textmessage);
                    }
                }, 1000*40);
            }
        }

public void Send_SMS(String phonenumber, String message){

    // here you use sms manager to send the sms
}

Upvotes: 2

Avinash
Avinash

Reputation: 31

If you are sending a lot sms together it will flood your phone so it is preferable to have some delay.

Next if you do delay you have to see to that it is not done in the UI thread or else you will get ANR.

Try using handlers, my friend suggested this, I tried and it works fine.

As for Generic issue, I am not sure.. The name Generic makes it sound like it could be a normal network error.

Hope this information is useful.

Upvotes: 3

Nikhil Lamba
Nikhil Lamba

Reputation: 603

add this permissions in your AndroidManifest file

   <uses-permission android:name="android.permission.SEND_SMS"/>
   <uses-permission android:name="android.permission.RECEIVE_SMS"/>

Upvotes: 0

Related Questions