SMS broadcast reciver not working
<p>I have library that I have created, I use the following to handle and log if the sms is sent and/or delivered, but its not working. It always returns sent and delivered even if the phone has no signal or no airtime.</p>

<p>The receiver</p>

<pre><code>private void setSentIntent() {
     Context currContext = mContext.getApplicationContext();

        String SENT = "SMS_SENT";
        String DELIVERED = "SMS_DELIVERED";

        sentPI = PendingIntent.getBroadcast(mContext, 0,
                new Intent(SENT), 0);

         deliveredPI = PendingIntent.getBroadcast(mContext, 0,
                new Intent(DELIVERED), 0);

         currContext.registerReceiver(new BroadcastReceiver(){
                    @Override
                    public void onReceive(Context arg0, Intent arg1) {
                    log("SMS FUNCTION: SEND CHECK");
                    switch (getResultCode())
                    {
                        case Activity.RESULT_OK:
                            break;
                        case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
                            log("SMS FUNCTION: SEND CHECK1");
                            sendEventLog("moFailed(Generic failure)");  
                            break;
                        case SmsManager.RESULT_ERROR_NO_SERVICE:
                            log("SMS FUNCTION: SEND CHECK2");
                            break;
                        case SmsManager.RESULT_ERROR_NULL_PDU:
                            log("SMS FUNCTION: SEND CHECK3");   
                            break;
                        case SmsManager.RESULT_ERROR_RADIO_OFF:
                            log("SMS FUNCTION: SEND CHECK4");   
                            break;
                    }

                }
             }, new IntentFilter(SENT));

         currContext.registerReceiver(new BroadcastReceiver(){
            @Override
            public void onReceive(Context arg0, Intent arg1) {
                log("SMS FUNCTION: SMS DELIVER CHECK");
                switch (getResultCode())
                {
                    case Activity.RESULT_OK:
                        log("SMS FUNCTION: SMS DELIVER CHECK1");
                        break;
                    case Activity.RESULT_CANCELED:
                        log("SMS FUNCTION: SMS DELIVER CHECK2");
                        break;
                }
            }
         }, new IntentFilter(DELIVERED)); 
    }
</code></pre>

<p>And the send code</p>

<pre><code>   private void sendSMS(String keyword, String msisdn) { 
       setSentIntent()
   SmsManager MySmsManager = SmsManager.getDefault();

   if (keyword != null) {
       MySmsManager.sendTextMessage(msisdn, null, keyword, sentPI, deliveredPI);

       if (saveOut) {
           msgInbox(msisdn, keyword);
       }
    }
   }
</code></pre>

<p>Please help</p>
