Use This Code to delete last sms after recieving sms in your first activity class. Dont forget 
togive sms read and write permission in your mainfest file.

  Uri uriSms = Uri.parse("content://sms/");
            Cursor c = getContentResolver().query(uriSms,
                new String[] { "_id", "thread_id", "address","person", "date", "body" }, null, null, null);
            if (c != null &amp;&amp; c.moveToFirst()) {

                    long id = c.getLong(0);
                    getContentResolver().delete(Uri.parse("content://sms/" + id), null, null);

            }`enter code here`


Removal of the incoming sms
I'm setting file name like 'abc_1.pdf' where '1' is the value of a model's attribute. But brakeman scanner take this as security issue. I need to keep track of files by referencing file name with model attribute. Can you please tell me, what is the right way to fix this security issue?

Thanks.
