title: How to delete sms from inbox?
body: <p>I've programmed an automatic sms responder:</p>
  
  <pre><code>.
  .
  .
  function IsSMSAnswered(smsid: string): Boolean;
  begin
    // Code to test if SMS is answered
  end;
  
  procedure SendReplySMS(reply_smssender, reply_smsbody: string);
  begin
    // Code to send reply to smssender
  end;
  
  procedure FetchSMS;  //fetch sms used by timer every 1 minute
  var
    cursor: JCursor;
    uri: Jnet_Uri;
  
    id_smsid: integer;
    id_smssender: integer;
    id_smsbody: integer;
  
    id_smsid: string;
    smssender: string;
    smsbody: string;
    smsreply: string;
  begin
    uri:= StrToJURI('content://sms/inbox');
    cursor:= SharedActivity.getContentResolver.query(uri, nil, nil, nil, nil);
  
    id_smsid:= cursor.getColumnIndex(StringToJstring('_id'));
    id_smssender:= cursor.getColumnIndex(StringToJstring('address'));
    id_smsbody:=cursor.getColumnIndex(StringToJstring('body'));
  
    cursor.moveToLast;
    for i:= cursor.getCount downto 1 do
      begin
        smsid:= :=JStringToString(cursor.getString(id_smsid));
  
        if not IsSMSAnswered(smsid) then
          begin
            smssender:=JStringToString(cursor.getString(id_smssender));
            smsbody:=JStringToString(cursor.getString(id_smssender));
  
            if smsbody = 'abc' then
              SendReplySMS(smssender, 'reply abc')
            else if smsbody = 'def' then
              SendReplySMS(smssender, 'reply def');
          end
        else
          Break;
      end;
  end;
  .
  .
  .
  </code></pre>
  
  <p>In this case remain all received sms messages in the phone database.</p>
  
  <p><strong>How do I delete the received SMS message from the phone database after processing?</strong></p>
  
  <pre><code>.
  .
  .
  if not IsSMSAnswered(smsid) then
    begin
      smssender:=JStringToString(cursor.getString(id_smssender));
      smsbody:=JStringToString(cursor.getString(id_smssender));
  
      if smsbody = 'abc' then
        SendReplySMS(smssender, 'reply abc')
      else if smsbody = 'def' then
        SendReplySMS(smssender, 'reply def');
  
      ???? Now do I delete this received message ????
    end
  .
  .
  .
  </code></pre>