Skip to content Skip to sidebar Skip to footer

Deleting Sms Using Broadcastreceiver - Android

i have broadcast receiver class for receiving sms, but i dont know how to delete the received sms before reaching to the inbox as well as the notification public void onReceive(Con

Solution 1:

In your intent filter you should set the priority higher than the systems SMS-application.

<intent-filter android:priority="100" ...

And then in your broadcast receiver you call abortBroadcast()

   public void onReceive(Context context, Intent intent) {
     //... abortBroadcast();
   }

Solution 2:

<receiverandroid:name=".SMSReceiver"android:permission="android.permission.BROADCAST_SMS"><intent-filterandroid:priority="999" ><actionandroid:name="android.provider.Telephony.SMS_RECEIVED" /></intent-filter></receiver>

and in receiver

  public void onReceive(Context context, Intent intent) {
     //... abortBroadcast();
   }

This will work fine.

Post a Comment for "Deleting Sms Using Broadcastreceiver - Android"