react-native-get-sms-android icon indicating copy to clipboard operation
react-native-get-sms-android copied to clipboard

delete message

Open Updour opened this issue 5 years ago • 6 comments

how to delete message in use this module? if (responses.status === 200) { messages.forEach((obj) => { console.log(obj.type) SmsAndroid.delete( Screenshot from 2020-01-10 09-52-33

        obj._id,
        (fail) => {
          console.log('Failed with this error: ' + fail);
        },
        (success) => {
          console.log('SMS deleted successfully');
        },
        );
     })
   }
  }, 1000);

//error LOG 1 // obj._id LOG Failed with this error: SMS not found //this error help me\

Updour avatar Jan 06 '20 07:01 Updour

Hi @Updour

Apologies for the delay, was off for a while. Going to look into this and get back to you.

briankabiro avatar Jan 13 '20 08:01 briankabiro

Hi @Updour. From the screenshot, I see that it's saying SMS Not Found.

Could you show the code of how you are accessing the specific message that you are going to delete?

i.e this section

SmsAndroid.delete(
  _id,
  (fail) => {
    console.log('Failed with this error: ' + fail);
  },
  (success) => {
    console.log('SMS deleted successfully');
  },
);

briankabiro avatar Jan 15 '20 03:01 briankabiro

yes of course this code only runs on the Android version of Jelly Bean ?? because there this code works well,

this code https://pastebin.com/89CC3zKw

Updour avatar Jan 15 '20 03:01 Updour

Ah I think I know what the issue is.

Screen Shot 2020-01-20 at 17 46 11

You can check out the whole thread here: https://stackoverflow.com/questions/8614211/deleting-android-sms-programmatically

That's the reason why it works on Jellybean and not on any later versions.

I thought this was in the docs; I think I'll have to update the README to make the distinction

briankabiro avatar Jan 20 '20 14:01 briankabiro

well, I hope there is a new README in the future, and thank you for the answer to this,

So, is it still running on Jelly Bean right ??

Updour avatar Jan 21 '20 02:01 Updour

Yes. You should be able to delete the message on Jelly Bean.

briankabiro avatar Jan 21 '20 11:01 briankabiro