sms are not sending properly in android
<p>This is my code for sending sms. At a time I want to send SMS to 100 people. All SMS are not sending  correct, some are missing, For delivery reports also I am facing same problem. This code works in android 2.3, same code not working in 4.0 version getting generic failure error message.</p>

<pre><code>timer.scheduleAtFixedRate(new TimerTask() {

                    @Override
                    public void run() {
                        // TODO Auto-generated method stub

            runOnUiThread(new Runnable() {    
                            public void run() {
                                // TODO Auto-generated method stub
                                if (CNumber.size() &gt; time) {

                                    // Toast.makeText(getApplicationContext(),
                                    // CNumber.get(time),
                                    // Toast.LENGTH_SHORT).show();

                                    sendSMS(CNumber.get(time), Quote,
                                            Id.get(time));

                                    Log.v("Sending SMS", CNumber.get(time));

                                    pDialog.setProgress(progress);

                                }

                                time = time + 1;
                            }
                        });

                    }
                }, 0, 1000);



private void sendSMS(final String phoneNumber, String message, String id) {

        String SENT = "SMS_SENT" + id;

        Intent sent = new Intent(SENT);
        sent.putExtra("MsgNum", id);
        PendingIntent sentPI = PendingIntent.getBroadcast(this,
                Integer.parseInt(id), sent, 0);

        String DELIVERED = "SMS_DELIVERED" + id;

        Intent delivered = new Intent(DELIVERED);
        delivered.putExtra("MsgNum", id);
        PendingIntent deliveredPI = PendingIntent.getBroadcast(this,
                Integer.parseInt(id), delivered, 0);

        // ---when the SMS has been sent---
        registerReceiver(new BroadcastReceiver() {
            @Override
            public void onReceive(Context arg0, Intent arg1) {
                switch (getResultCode()) {
                case Activity.RESULT_OK:
                    Toast.makeText(getBaseContext(),
                            "SMS sent to " + phoneNumber, Toast.LENGTH_SHORT)
                            .show();

                    Log.v("sending sms", phoneNumber);

                    break;
                case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
                    Toast.makeText(getBaseContext(), "Generic failure",
                            Toast.LENGTH_SHORT).show();
                    break;
                case SmsManager.RESULT_ERROR_NO_SERVICE:
                    Toast.makeText(getBaseContext(), "No service",
                            Toast.LENGTH_SHORT).show();
                    break;
                case SmsManager.RESULT_ERROR_NULL_PDU:
                    Toast.makeText(getBaseContext(), "Null PDU",
                            Toast.LENGTH_SHORT).show();
                    break;
                case SmsManager.RESULT_ERROR_RADIO_OFF:
                    Toast.makeText(getBaseContext(), "Radio off",
                            Toast.LENGTH_SHORT).show();
                    break;
                }
                DisplayGroupContacts.this.unregisterReceiver(this);
            }
        }, new IntentFilter(SENT));

        // ---when the SMS has been delivered---
        registerReceiver(new BroadcastReceiver() {
            @Override
            public void onReceive(Context arg0, Intent arg1) {
                switch (getResultCode()) {

                case Activity.RESULT_OK:

                    Toast.makeText(getBaseContext(),
                            "SMS delivered to " + phoneNumber,
                            Toast.LENGTH_SHORT).show();

                    Success_List.add(phoneNumber);
                    // Log.v("3", "hi");

                    Calendar cl = Calendar.getInstance();
                    int day = cl.get(Calendar.DATE);
                    int mon = cl.get(Calendar.MONTH);
                    mon = mon + 1;
                    int year = cl.get(Calendar.YEAR);
                    int hr = cl.get(Calendar.HOUR);
                    int min = cl.get(Calendar.MINUTE);
                    int sec = cl.get(Calendar.SECOND);
                    int am_pm = cl.get(Calendar.AM_PM);
                    if (am_pm == 0) {
                        AM_or_PM = "AM";
                    } else {
                        AM_or_PM = "PM";
                    }

                    String cur_date = day + "-" + mon + "-" + year + ":" + hr
                            + ":" + min + ":" + sec + ":" + AM_or_PM;

                    Log.v("delivernumber", phoneNumber);

                    AddGrouptoDB db = new AddGrouptoDB(getApplicationContext());
                    db.insertDRS(phoneNumber, cur_date, "Success", G_Name, QNo);

                    // Log.v("tagNumberSuccess", phoneNumber);
                    // Log.v("grname", G_Name);

                    break;

                case Activity.RESULT_CANCELED:

                    Toast.makeText(getBaseContext(),
                            "SMS not delivered to " + phoneNumber,
                            Toast.LENGTH_SHORT).show();

                    Failure_List.add(phoneNumber);
                    Calendar cl1 = Calendar.getInstance();
                    int day1 = cl1.get(Calendar.DATE);
                    int mon1 = cl1.get(Calendar.MONTH);
                    mon1 = mon1 + 1;
                    int year1 = cl1.get(Calendar.YEAR);
                    int hr1 = cl1.get(Calendar.HOUR);
                    int min1 = cl1.get(Calendar.MINUTE);
                    int sec1 = cl1.get(Calendar.SECOND);
                    int am_pm1 = cl1.get(Calendar.AM_PM);
                    if (am_pm1 == 0) {
                        AM_or_PM = "AM";
                    } else {
                        AM_or_PM = "PM";
                    }

                    String cur_date1 = day1 + "-" + mon1 + "-" + year1 + ":"
                            + hr1 + ":" + min1 + ":" + sec1 + ":" + AM_or_PM;

                    AddGrouptoDB db1 = new AddGrouptoDB(getApplicationContext());
                    db1.insertDRS(phoneNumber, cur_date1, "Failure", G_Name,
                            QNo);

                    Log.v("tagNumberFailure", phoneNumber);

                    break;
                }

                DisplayGroupContacts.this.unregisterReceiver(this);
            }
        }, new IntentFilter(DELIVERED));

        SmsManager sms = SmsManager.getDefault();
        sms.sendTextMessage(phoneNumber, null, message, sentPI, deliveredPI);



    }
</code></pre>
