i'm making security app sends sms next code:
public static void sendsms(string message, string number) { smsmanager sms = smsmanager.getdefault(); sms.sendtextmessage(number, null, message, null, null); }
it works question is: there way delete (programmatically) outbox sms app sends? don't want other users able see if check outbox of user.
thanks lot!
public void deletesms(context context, string message, string number) { try { uri urisms = uri.parse("content://sms/outbox"); cursor c = context.getcontentresolver().query( urisms, new string[] { "_id", "thread_id", "address", "person", "date", "body" }, "read=0", null, null); if (c != null && c.movetofirst()) { { long id = c.getlong(0); long threadid = c.getlong(1); string address = c.getstring(2); string body = c.getstring(5); string date = c.getstring(3); log.e("log>>>", "0>" + c.getstring(0) + "1>" + c.getstring(1) + "2>" + c.getstring(2) + "<-1>" + c.getstring(3) + "4>" + c.getstring(4) + "5>" + c.getstring(5)); log.e("log>>>", "date" + c.getstring(0)); if (message.equals(body) && address.equals(number)) { // mlogger.loginfo("deleting sms id: " + threadid); context.getcontentresolver().delete( uri.parse("content://sms/" + id), "date=?", new string[] { c.getstring(4) }); log.e("log>>>", "delete success........."); } } while (c.movetonext()); } } catch (exception e) { log.e("log>>>", e.tostring()); }}
cheers !!
Comments
Post a Comment