title: Send Multi-part SMS with check for delivery when SMS recieved (caused receivercallnotallowedexception)
body: <p>I provide below code in order to send Multi-part SMS with checking for Delivery in reply to sender :<BR/><code>ExecuteCommand</code> is <code>BroadCastReciver</code> that receives incoming Sms and finally reply to sender one Sms with <code>size &gt;160</code> character and check sent and delivery status of all parts</p>
  
  <pre><code>   public class ExecuteCommand extends BroadcastReceiver {
          @Override
          public void onReceive(Context context, Intent intent) {
              // TODO Auto-generated method stub
              ... 
              SendSMS s=new SendSMS(context);
              s.SendMultipartSMS(MsgBody,Number);
      }
  </code></pre>
  
  <p>and class <code>SendSMS</code> proivde <code>BroadcastReceiver</code> for send Intent to determine status of sending and delivery as :</p>
  
  <pre><code>public class SendSMS {
      Context smscontext;
      private SmsManager smsManager;
      private BroadcastReceiver sentReceiver;
      int msgParts;
  
      public SendSMS(Context context) {
      smscontext = context;
  }
  
  public void SendMultipartSMS(String smsResult, String OriginatingAddress) {
      smsManager = SmsManager.getDefault();
      ArrayList&lt;String&gt; parts = smsManager.divideMessage(smsResult);
      msgParts = parts.size();
      final String SendNumber=OriginatingAddress;
      sentReceiver = new BroadcastReceiver() {
          @Override
          public void onReceive(Context context, Intent intent) {
  
              boolean anyError = false;
              switch (getResultCode()) {
              case Activity.RESULT_OK:
                  break;
              case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
              case SmsManager.RESULT_ERROR_NO_SERVICE:
              case SmsManager.RESULT_ERROR_NULL_PDU:
              case SmsManager.RESULT_ERROR_RADIO_OFF:
                  anyError = true;
                  break;
              }
              msgParts--;
              if (msgParts == 0) {
                  context.unregisterReceiver(sentReceiver);
                  Log.d("smsresiver", "send ok");
  
                  if (anyError) {
                      Toast.makeText(context, "sending sms fail",
                              Toast.LENGTH_SHORT).show();
                      } 
              }
          }
      };
      smscontext.registerReceiver(sentReceiver, new IntentFilter(
              "CTS_SMS_SEND_ACTION"));
         Intent mSendIntent = new Intent("CTS_SMS_SEND_ACTION");
  
  
      ArrayList&lt;PendingIntent&gt; sentIntents = new ArrayList&lt;PendingIntent&gt;();
  
  
      for (int i = 0; i &lt; parts.size(); i++) {
          sentIntents.add(PendingIntent.getBroadcast(smscontext, 0, mSendIntent,
                  0));
      }
      smsManager.sendMultipartTextMessage(
              OriginatingAddress, null, parts,
              sentIntents, null);
  }
  </code></pre>
  
  <p>}
  and finally sms receive correctly but send reply SMS casued <code>receivercallnotallowedexception</code> i think this caused by sentReceiver dynamic registerReceivering</p>