title: how to delete broadcast message after read it by my app?
body: <p>I read a broadcast sms in my app. </p>
  
  <p>I want to  first check a specific pattern exist or not in that message. If not exist then I want to delete that sms without saving it in inbox folder. </p>
  
  <p>I am able to read sms successfully in my app but unable to delete it. Code snippet as below.</p>
  
  <pre><code>public class SmsListener extends BroadcastReceiver {
  @Override
  public void onReceive(Context context, Intent intent) {
      if (Telephony.Sms.Intents.SMS_RECEIVED_ACTION.equals(intent.getAction())) {
          if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.KITKAT) {
              for (SmsMessage smsMessage : Telephony.Sms.Intents.getMessagesFromIntent(intent)) {
                  String  messageBody = smsMessage.getMessageBody();
                  String pattern="$Ntmds";
                  if(messageBody.indexOf(pattern)!=-1){
                      Log.d("sdsd,", String.valueOf(messageBody));
                  }else {
                      //i want to delete here
                     // abortBroadcast(); &lt;-- this is nnot working for me
                      Log.d("vb,", String.valueOf(messageBody));
                  }
              }
          }
      }
  }
  }
  </code></pre>
  
  <p><strong>AndroidManifest.xml</strong></p>
  
  <pre><code> &lt;receiver android:name=".SmsListener"&gt;
          &lt;intent-filter android:priority="2147483647"&gt;
              &lt;action android:name="android.provider.Telephony.SMS_RECEIVED" /&gt;
          &lt;/intent-filter&gt;
      &lt;/receiver&gt;
  </code></pre>
  
  <p>I tried a lot but not getting any success. I used by <strong>abortBroadcast()</strong>  but its also not work for me. please help me.</p>