Programmatically delete sms / message by sms id in android

How to delete all messages from android inbox or sent folders, without loop

How to get message ids

Use following simple function to delete sms from default android application / database.


public boolean deleteSms(String smsId) {
        boolean isSmsDeleted = false;
        try {
                    Uri.parse("content://sms/" + smsId), null, null);
            isSmsDeleted = true;

        } catch (Exception ex) {
            isSmsDeleted = false;
        return isSmsDeleted;


use this permission in AndroidManifiest

<uses-permission android:name="android.permission.WRITE_SMS"/>


Leave a comment

Your email address will not be published.