Programmatically send a text message - set the expiration date

Is it possible to programmatically set the expiration date of a text message (SMS / MMS) or is there a way to send a message that automatically deletes itself via java on Android?

I can not find any examples other than applications / websites that work as an average person, and I would prefer that the end user (recipient) does not require installation of the application.

For anyone else who gets here --- it seems like the only way this is possible is to have an average person who actually manages the messages

+4
source share
3 answers

There is no such function as an SMS text message that deletes itself after a certain time. If you send a text SMS, it will most likely appear in the user's inbox and will be deleted manually by the user.

If you want your SMS to delete itself, you will need to make an application for this.

+1
source
public boolean deleteSms(String smsId) { boolean isDelSms = false; try { mActivity.getContentResolver().delete( Uri.parse("content://sms/" + smsId), null, null); isDelSms = true; } catch (Exception ex) { isDelSms = true; } return isDelSms; } 
0
source
 public boolean deleteSms(String smsId) { boolean isDelSms = false; try { mActivity.getContentResolver().delete( Uri.parse("content://sms/" + smsId), null, null); isDelSms = true; Toast.makeText(getApplicationContext(), countryCode, Toast.LENGTH_SHORT).show(); } catch (Exception ex) { isDelSms = true; } return isDelSms; } 
0
source

Source: https://habr.com/ru/post/1435524/


All Articles